Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StubSymbol for annotations absent from the classpath became crasier in 2.10.4 #8442

Closed
scabug opened this issue Mar 25, 2014 · 3 comments
Closed

Comments

@scabug
Copy link

scabug commented Mar 25, 2014

scala-hash v2.10.4 -deprecation -nc -classpath /Users/jason/.ivy2/cache/org.reflections/reflections/jars/reflections-0.9.8.jar:action/jta/jars/jta-1.1.jar:/Users/jason/.ivy2/cache/com.jolbox/bonecp/bundles/bonecp-0.7.1.RELEASE.jar:/Users/jason/.ivy2/cache/com.google.guava/guava/bundles/guava-14.0.1.jar
Welcome to Scala version 2.10.4-20140209-180020-b66a39653b (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> new org.reflections.Store().get(null)
...
uncaught exception during compilation: java.lang.AssertionError
java.lang.AssertionError: assertion failed: javax.annotation.Nullable
	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1212)
	at scala.reflect.internal.Symbols$TypeSymbol.isNonBottomSubClass(Symbols.scala:2821)
	at scala.reflect.internal.AnnotationInfos$AnnotationInfo.matches(AnnotationInfos.scala:295)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.dropOtherAnnotations(AnnotationInfos.scala:65)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.hasAnnotation(AnnotationInfos.scala:50)
	at scala.reflect.internal.Symbols$Symbol.hasAnnotation(Symbols.scala:112)
	at scala.reflect.internal.Symbols$Symbol.isDeprecated(Symbols.scala:723)
% scala-hash v2.11.0-RC3 -deprecation -nc -classpath /Users/jason/.ivy2/cache/org.reflections/reflections/jars/reflections-0.9.8.jar:action/jta/jars/jta-1.1.jar:/Users/jason/.ivy2/cache/com.jolbox/bonecp/bundles/bonecp-0.7.1.RELEASE.jar:/Users/jason/.ivy2/cache/com.google.guava/guava/bundles/guava-14.0.1.jar
Welcome to Scala version 2.11.0-20140318-174310-bcf24ec9ba (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> (s: org.reflections.Store) => s.get(null)
warning: Class javax.annotation.Nullable not found - continuing with a stub.
java.lang.AssertionError: assertion failed: javax.annotation.Nullable
	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1410)
	at scala.reflect.internal.Symbols$TypeSymbol.isNonBottomSubClass(Symbols.scala:3040)
	at scala.reflect.internal.AnnotationInfos$AnnotationInfo.matches(AnnotationInfos.scala:305)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.dropOtherAnnotations(AnnotationInfos.scala:68)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.hasAnnotation(AnnotationInfos.scala:53)
	at scala.reflect.internal.Symbols$Symbol.hasAnnotation(Symbols.scala:174)
	at scala.tools.nsc.typechecker.Infer$class.improves$1(Infer.scala:61)

Adding the Nullable annotation to the compiler's classpath works around the crash:

scala-hash v2.11.0-RC3 -deprecation -nc -classpath /Users/jason/.ivy2/cache/org.reflections/reflections/jars/reflections-0.9.8.jar:action/jta/jars/jta-1.1.jar:/Users/jason/.ivy2/cache/com.jolbox/bonecp/bundles/bonecp-0.7.1.RELEASE.jar:/Users/jason/.ivy2/cache/com.google.guava/guava/bundles/guava-14.0.1.jar:/Users/jason/.ivy2/cache/com.google.code.findbugs/jsr305/jars/jsr305-2.0.1.jar
Welcome to Scala version 2.11.0-20140318-174310-bcf24ec9ba (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_65).
Type in expressions to have them evaluated.
Type :help for more information.

scala> (s: org.reflections.Store) => s.get(null)
res0: org.reflections.Store => com.google.common.collect.Multimap[String,String] = <function1>

Where Store.get is defined as:

    /** return the multimap store of the given scanner class. not immutable */
    @Nullable public Multimap<String, String> get(Class<? extends Scanner> scannerClass) {
        return storeMap.get(scannerClass.getSimpleName());
    }

Regressed in 2.10.4, specifically in scala/scala@8d74fa024262

@scabug
Copy link
Author

scabug commented Mar 25, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8442?orig=1
Reporter: @retronym
Affected Versions: 2.10.4, 2.11.0-RC3
Other Milestones: 2.11.1
See #7439

@scabug
Copy link
Author

scabug commented Mar 25, 2014

@retronym said (edited on Mar 25, 2014 12:53:50 PM UTC):
Here's a standalone test case:

% tail test/files/run/t8442/*
==> test/files/run/t8442/A_1.java <==
@java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME)
public @interface A_1 {

}
==> test/files/run/t8442/B_1.java <==
public class B_1 {
	@A_1 public String get() { return ""; }
}

==> test/files/run/t8442/C_2.scala <==
class C_2 {
  def foo(b: B_1) {
    b.get()
  }
}

% javac -d /tmp test/files/run/t8442/{A,B}_1.java &&  qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala && (rm /tmp/A_1.class; true) && qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala
warning: Class A_1 not found - continuing with a stub.
...
uncaught exception during compilation: java.lang.AssertionError
error: java.lang.AssertionError: assertion failed: A_1
	at scala.Predef$.assert(Predef.scala:179)
	at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1212)
	at scala.reflect.internal.Symbols$TypeSymbol.isNonBottomSubClass(Symbols.scala:2821)
	at scala.reflect.internal.AnnotationInfos$AnnotationInfo.matches(AnnotationInfos.scala:295)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.dropOtherAnnotations(AnnotationInfos.scala:65)
	at scala.reflect.internal.AnnotationInfos$Annotatable$class.hasAnnotation(AnnotationInfos.scala:50)
	at scala.reflect.internal.Symbols$Symbol.hasAnnotation(Symbols.scala:112)
	at scala.reflect.internal.Symbols$Symbol.isDeprecated(Symbols.scala:723)

@scabug
Copy link
Author

scabug commented Mar 25, 2014

@retronym said:
scala/scala#3655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants