File tree 3 files changed +10
-2
lines changed
compiler/src/dotty/tools/dotc/profile
library/src/scala/runtime
3 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1
1
package dotty .tools .dotc .profile
2
2
3
+ import scala .annotation .*
3
4
import scala .language .unsafeNulls
4
5
5
6
import java .io .{FileWriter , PrintWriter }
@@ -123,6 +124,7 @@ private [profile] class RealProfiler(reporter : ProfileReporter)(using Context)
123
124
}
124
125
private def readHeapUsage () = RealProfiler .memoryMx.getHeapMemoryUsage.getUsed
125
126
127
+ @ nowarn
126
128
private def doGC : Unit = {
127
129
System .gc()
128
130
System .runFinalization()
Original file line number Diff line number Diff line change 1
1
package scala .runtime
2
2
3
+ import scala .annotation .*
4
+
3
5
/**
4
6
* Helper methods used in thread-safe lazy vals.
5
7
*/
6
8
object LazyVals {
9
+ @ nowarn
7
10
private [this ] val unsafe : sun.misc.Unsafe =
8
11
classOf [sun.misc.Unsafe ].getDeclaredFields.nn.find { field =>
9
12
field.nn.getType == classOf [sun.misc.Unsafe ] && {
@@ -100,13 +103,15 @@ object LazyVals {
100
103
}
101
104
102
105
def getOffset (clz : Class [_], name : String ): Long = {
106
+ @ nowarn
103
107
val r = unsafe.objectFieldOffset(clz.getDeclaredField(name))
104
108
if (debug)
105
109
println(s " getOffset( $clz, $name) = $r" )
106
110
r
107
111
}
108
112
109
113
def getOffsetStatic (field : java.lang.reflect.Field ) =
114
+ @ nowarn
110
115
val r = unsafe.objectFieldOffset(field)
111
116
if (debug)
112
117
println(s " getOffset( ${field.getDeclaringClass}, ${field.getName}) = $r" )
Original file line number Diff line number Diff line change @@ -169,9 +169,10 @@ object Build {
169
169
" -feature" ,
170
170
" -deprecation" ,
171
171
" -unchecked" ,
172
- " -Xfatal-warnings" ,
172
+ // "-Wconf:cat=deprecation&msg=Unsafe:s", // example usage
173
+ " -Xfatal-warnings" , // -Werror in modern usage
173
174
" -encoding" , " UTF8" ,
174
- " -language:implicitConversions"
175
+ " -language:implicitConversions" ,
175
176
),
176
177
177
178
(Compile / compile / javacOptions) ++= Seq (" -Xlint:unchecked" , " -Xlint:deprecation" ),
You can’t perform that action at this time.
0 commit comments