Skip to content

Commit a5c49c6

Browse files
committed
Parse native in Java bytecode as @Native
1 parent 5ada87f commit a5c49c6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

compiler/src/dotty/tools/dotc/core/classfile/ClassfileParser.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,7 @@ class ClassfileParser(
275275
def complete(denot: SymDenotation)(using Context): Unit = {
276276
val sym = denot.symbol
277277
val isEnum = (jflags & JAVA_ACC_ENUM) != 0
278+
val isNative = (jflags & JAVA_ACC_NATIVE) != 0
278279
val isConstructor = name eq nme.CONSTRUCTOR
279280

280281
/** Strip leading outer param from constructor and trailing access tag for
@@ -313,6 +314,10 @@ class ClassfileParser(
313314
val isVarargs = denot.is(Flags.Method) && (jflags & JAVA_ACC_VARARGS) != 0
314315
denot.info = sigToType(sig, isVarargs = isVarargs)
315316
if (isConstructor) normalizeConstructorParams()
317+
if isNative then
318+
attrCompleter.annotations ::= Annotation.deferredSymAndTree(defn.NativeAnnot) {
319+
New(defn.NativeAnnot.typeRef, Nil)
320+
}
316321
denot.info = translateTempPoly(attrCompleter.complete(denot.info, isVarargs))
317322
if (isConstructor) normalizeConstructorInfo()
318323

0 commit comments

Comments
 (0)