You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What steps will reproduce the problem?
1. define two java sources
//File bug2/BugP.java
package bug2;
class Bug extends BugP
{
public Bug()
{
// Accessing field one causes NPE
// at checkers.nullness.MapGetHeuristics.handle
// (MapGetHeuristics.java:91)
int two = one+1;
}
}
//File bug2/Bug.java
package bug2;
public class BugP
{
public final int one = "1".length();
//fix 1: public final int one; {one= "1".length();}
//fix 2: public final int one = 0 + "1".length();
public BugP()
{
}
}
// Remark1: if both sources are defined in the same file, the bug is not raising
// Remark2: if compiling BugP alone and later Bug alone, the bug also doesn't
appear
2. Compile with the nullness checker
What is the expected output? What do you see instead?
NPE, see below.
What version of the product are you using? On what operating system?
checkers.nullness.NullnessChecker
javac 1.7.0-jsr308-1.2.0.1
Windows XP SP3
Please provide any additional information below.
### Checker Framework compiler used. Checkers: checkers.nullness.NullnessChecker
### Used options: -Awarns
javac 1.7.0-jsr308-1.2.0.1
[parsing started RegularFileObject[bug2\Bug.java]]
[parsing started RegularFileObject[bug2\BugP.java]]
Round 1:
input files: {bug2.Bug, bug2.BugP}
annotations: []
last round: false
Processor checkers.nullness.NullnessChecker matches [] and returns false.
Round 2:
input files: {}
annotations: []
last round: true
java.lang.Error: NullnessSubchecker processor threw unexpected exception when
processing bug2\Bug.java
at checkers.source.SourceChecker.typeProcess(SourceChecker.java:327)
at checkers.util.AggregateChecker.typeProcess(AggregateChecker.java:59)
at com.sun.source.util.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:212)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1268)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1227)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:881)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:840)
at com.sun.tools.javac.main.Main.compile(Main.java:419)
at com.sun.tools.javac.main.Main.compile(Main.java:333)
at com.sun.tools.javac.main.Main.compile(Main.java:324)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)
at checkers.util.CheckerMain.main(CheckerMain.java:39)
Caused by: java.lang.NullPointerException
at checkers.nullness.MapGetHeuristics.handle(MapGetHeuristics.java:91)
at checkers.nullness.NullnessAnnotatedTypeFactory.methodFromUse(NullnessAnnotatedTypeFactory.java:228)
at checkers.types.TypeFromTree$TypeFromExpression.visitMethodInvocation(TypeFromTree.java:247)
at checkers.types.TypeFromTree$TypeFromExpression.visitMethodInvocation(TypeFromTree.java:100)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1337)
at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
at checkers.types.AnnotatedTypeFactory.fromTreeWithVisitor(AnnotatedTypeFactory.java:454)
at checkers.types.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:394)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:265)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:982)
at checkers.nullness.NullnessAnnotatedTypeFactory.substituteRaw(NullnessAnnotatedTypeFactory.java:299)
at checkers.nullness.NullnessAnnotatedTypeFactory.annotateImplicit(NullnessAnnotatedTypeFactory.java:174)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:271)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:982)
at checkers.nullness.NullnessVisitor.checkForNullability(NullnessVisitor.java:372)
at checkers.nullness.NullnessVisitor.visitBinary(NullnessVisitor.java:173)
at checkers.nullness.NullnessVisitor.visitBinary(NullnessVisitor.java:49)
at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1583)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.visitVariable(TreeScanner.java:151)
at checkers.basetype.BaseTypeVisitor.visitVariable(BaseTypeVisitor.java:237)
at checkers.basetype.BaseTypeVisitor.visitVariable(BaseTypeVisitor.java:73)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:740)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:160)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:794)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:143)
at checkers.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:218)
at checkers.nullness.NullnessVisitor.visitMethod(NullnessVisitor.java:239)
at checkers.nullness.NullnessVisitor.visitMethod(NullnessVisitor.java:49)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:694)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:98)
at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:132)
at checkers.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:158)
at checkers.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:73)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:618)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:49)
at checkers.source.SourceChecker.typeProcess(SourceChecker.java:319)
... 15 more
An exception has occurred in the compiler (1.7.0-jsr308-1.2.0.1). Please report
this bug so we can fix it. For instructions, see
http://types.cs.washington.edu/checker-framework/current/README-jsr308.html#repo
rting-bugs . Thank you.
java.lang.Error: NullnessSubchecker processor threw unexpected exception when
processing bug2\Bug.java
at checkers.source.SourceChecker.typeProcess(SourceChecker.java:327)
at checkers.util.AggregateChecker.typeProcess(AggregateChecker.java:59)
at com.sun.source.util.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:212)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.source.util.AbstractTypeProcessor$TaskListeners.finished(AbstractTypeProcessor.java:260)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1268)
at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1227)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:881)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:840)
at com.sun.tools.javac.main.Main.compile(Main.java:419)
at com.sun.tools.javac.main.Main.compile(Main.java:333)
at com.sun.tools.javac.main.Main.compile(Main.java:324)
at com.sun.tools.javac.Main.compile(Main.java:76)
at com.sun.tools.javac.Main.main(Main.java:61)
at checkers.util.CheckerMain.main(CheckerMain.java:39)
Caused by: java.lang.NullPointerException
at checkers.nullness.MapGetHeuristics.handle(MapGetHeuristics.java:91)
at checkers.nullness.NullnessAnnotatedTypeFactory.methodFromUse(NullnessAnnotatedTypeFactory.java:228)
at checkers.types.TypeFromTree$TypeFromExpression.visitMethodInvocation(TypeFromTree.java:247)
at checkers.types.TypeFromTree$TypeFromExpression.visitMethodInvocation(TypeFromTree.java:100)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1337)
at com.sun.source.util.SimpleTreeVisitor.visit(SimpleTreeVisitor.java:52)
at checkers.types.AnnotatedTypeFactory.fromTreeWithVisitor(AnnotatedTypeFactory.java:454)
at checkers.types.AnnotatedTypeFactory.fromExpression(AnnotatedTypeFactory.java:394)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:265)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:982)
at checkers.nullness.NullnessAnnotatedTypeFactory.substituteRaw(NullnessAnnotatedTypeFactory.java:299)
at checkers.nullness.NullnessAnnotatedTypeFactory.annotateImplicit(NullnessAnnotatedTypeFactory.java:174)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:271)
at checkers.types.AnnotatedTypeFactory.getAnnotatedType(AnnotatedTypeFactory.java:982)
at checkers.nullness.NullnessVisitor.checkForNullability(NullnessVisitor.java:372)
at checkers.nullness.NullnessVisitor.visitBinary(NullnessVisitor.java:173)
at checkers.nullness.NullnessVisitor.visitBinary(NullnessVisitor.java:49)
at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1583)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.visitVariable(TreeScanner.java:151)
at checkers.basetype.BaseTypeVisitor.visitVariable(BaseTypeVisitor.java:237)
at checkers.basetype.BaseTypeVisitor.visitVariable(BaseTypeVisitor.java:73)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:740)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:160)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:794)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:80)
at com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:143)
at checkers.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:218)
at checkers.nullness.NullnessVisitor.visitMethod(NullnessVisitor.java:239)
at checkers.nullness.NullnessVisitor.visitMethod(NullnessVisitor.java:49)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:694)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:67)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:122)
at checkers.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:73)
at com.sun.source.util.TreeScanner.scan(TreeScanner.java:90)
at com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:98)
at com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:132)
at checkers.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:158)
at checkers.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:73)
at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:618)
at com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:49)
at checkers.source.SourceChecker.typeProcess(SourceChecker.java:319)
... 15 more
INTERNAL COMPILATION ERROR (exit code 4 but no recognized error messages)
Verbose output summary: 2 parsed sources, 0 loaded classes in project, 53
loaded classes in cp.
0 wrote classes, 0 wrote inner classes.
Compilation failed, duration = 0 s
Original issue reported on code.google.com by Stephan....@gmail.com on 6 Sep 2011 at 7:34
The text was updated successfully, but these errors were encountered:
Thanks for the easily reproducible bug report!
I just pushed changes that fix this problem and a second similar one that I
found when working on reproducing this error.
It was a tricky bug, caused by a Tree from a different Compilation Unit not
being usable.
Please do let me know if this also works in your original setting.
Original comment by wdi...@gmail.com on 7 Sep 2011 at 3:08
Original issue reported on code.google.com by
Stephan....@gmail.com
on 6 Sep 2011 at 7:34The text was updated successfully, but these errors were encountered: