ctolkmit / checker-framework

Automatically exported from code.google.com/p/checker-framework
0 stars 0 forks source link

Crash in BaseTypeVisitor.checkThrownExpression with union types #396

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

=== Test.java ===
class Test {
  void b() {
    try {
      System.err.println("Hello World");
    } catch (LinkageError | AssertionError e) {
      throw e;
    } 
  }
}
===

$ ~/jsr308/checker-framework-1.8.10/checker/bin/javac -processor 
org.checkerframework.checker.nullness.NullnessChecker -AprintErrorStack 
Test.java

What is the expected output? What do you see instead?

The checker crashes.

What version of the product are you using? On what operating system?

javac 1.8.0-jsr308-1.8.10

Please provide any additional information below.

error: Unexpected throw expression type: UNION
  Compilation unit: Test.java
  Exception: java.lang.Throwable; Stack trace: org.checkerframework.framework.source.SourceChecker.errorAbort(SourceChecker.java:608)
  org.checkerframework.javacutil.ErrorReporter.errorAbort(ErrorReporter.java:28)
  org.checkerframework.common.basetype.BaseTypeVisitor.checkThrownExpression(BaseTypeVisitor.java:1665)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitThrow(BaseTypeVisitor.java:1555)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitThrow(BaseTypeVisitor.java:168)
  com.sun.tools.javac.tree.JCTree$JCThrow.accept(JCTree.java:1413)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
  com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:162)
  com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:918)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81)
  com.sun.source.util.TreeScanner.visitCatch(TreeScanner.java:224)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitCatch(BaseTypeVisitor.java:1541)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitCatch(BaseTypeVisitor.java:168)
  com.sun.tools.javac.tree.JCTree$JCCatch.accept(JCTree.java:1213)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
  com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99)
  com.sun.source.util.TreeScanner.visitTry(TreeScanner.java:217)
  com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1183)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
  com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:162)
  com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:918)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81)
  com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:144)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:442)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:168)
  com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:800)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:257)
  org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:168)
  com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81)
  com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
  com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99)
  com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:133)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:307)
  org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:168)
  com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:720)
  com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:50)
  org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:70)
  org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:823)
  org.checkerframework.common.basetype.BaseTypeChecker.typeProcess(BaseTypeChecker.java:412)
  org.checkerframework.framework.source.AggregateChecker.typeProcess(AggregateChecker.java:123)
  org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:205)
  com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:681)
  com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:111)
  com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1342)
  com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
  com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
  com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
  com.sun.tools.javac.main.Main.compile(Main.java:523)
  com.sun.tools.javac.main.Main.compile(Main.java:381)
  com.sun.tools.javac.main.Main.compile(Main.java:370)
  com.sun.tools.javac.main.Main.compile(Main.java:361)
  com.sun.tools.javac.Main.compile(Main.java:56)
  com.sun.tools.javac.Main.main(Main.java:42)
1 error

Original issue reported on code.google.com by cus...@google.com on 6 Feb 2015 at 3:16

GoogleCodeExporter commented 9 years ago

Original comment by Suzanne....@gmail.com on 6 Feb 2015 at 4:34

GoogleCodeExporter commented 9 years ago
Thanks for the report.  This has been fixed:
https://code.google.com/p/checker-framework/source/detail?r=62f065a5f442
and will appear in the next release.

Original comment by Suzanne....@gmail.com on 6 Feb 2015 at 9:04

GoogleCodeExporter commented 9 years ago

Original comment by jtha...@cs.washington.edu on 2 Mar 2015 at 11:57