From 59f1ee5989c43206676d831ff696b5d656ac6727 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Tue, 21 Jul 2015 22:03:00 +0200 Subject: Query methods in api.Symbols for Java flags Adds query methods to the public reflection API for querying the JAVA_ENUM and JAVA_ANNOTATION flags. Didn't include JAVA_DEFAULTMETHOD because it does not correspond to a real java classfile flag (just a non-abstract method in an interface), and we want to clean the usage of this flag before adding it to a public API. The flags themselfs are not added to the reflection API. A comment in api/FlagSets.scala says: Q: I have a pretty flag. Can I put it here? A: Only if there's a tree that cannot be built without it. If you want to put a flag here so that it can be tested against, introduce an `isXXX` method in one of the api.Symbols classes instead. --- test/junit/scala/tools/nsc/symtab/FlagsTest.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/junit/scala/tools/nsc/symtab/FlagsTest.scala b/test/junit/scala/tools/nsc/symtab/FlagsTest.scala index fc0e8b0f6b..08a37fcb3c 100644 --- a/test/junit/scala/tools/nsc/symtab/FlagsTest.scala +++ b/test/junit/scala/tools/nsc/symtab/FlagsTest.scala @@ -86,4 +86,11 @@ class FlagsTest { assertEquals(withFlagMask(AllFlags)(sym.setFlag(lateFlags).flags), lateFlags | lateable) } + + @Test + def javaClassMirrorAnnotationFlag(): Unit = { + import scala.reflect.runtime.universe._ + val dep = typeOf[java.lang.Deprecated].typeSymbol + assertTrue(dep.isJavaAnnotation && dep.isJava) + } } -- cgit v1.2.3