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

Inference error in scenario involving enums and generics #6

Open
jthaine opened this issue Oct 14, 2015 · 2 comments
Open

Inference error in scenario involving enums and generics #6

jthaine opened this issue Oct 14, 2015 · 2 comments
Assignees
Labels

Comments

@jthaine
Copy link
Contributor

jthaine commented Oct 14, 2015

What steps will reproduce the problem?
Enable and run the following test: testdata/sparta-source/Issue6.java

What is the expected output? What do you see instead?
The test should pass. Instead, an exception is thrown:

[junit] INFO: - compiler.err.proc.messager: Unexpected AnnotatedTypeMirror with no primary annotation!
[junit] toSearch=Enum<capture#787 of ? extends Enum<capture#787 of ?>>
[junit] [email protected]
[junit] source=Enum<capture#787 of ? extends Enum<capture#787 of ?>>
[junit] Compilation unit: /Users/javier/sparta3/checker-framework-inference/testdata/sparta-source/Issue6.java
[junit] Exception: java.lang.Throwable; Stack trace: org.checkerframework.framework.source.SourceChecker.errorAbort(SourceChecker.java:669)
[junit] org.checkerframework.javacutil.ErrorReporter.errorAbort(ErrorReporter.java:28)
[junit] org.checkerframework.framework.util.AnnotatedTypes.findEffectiveAnnotationInHierarchy(AnnotatedTypes.java:1682)
[junit] org.checkerframework.framework.util.AnnotatedTypes.findEffectiveAnnotationInHierarchy(AnnotatedTypes.java:1638)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.subtypeAndCompare(StructuralEqualityComparer.java:349)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitTypevar_Typevar(StructuralEqualityComparer.java:300)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitTypevar_Typevar(StructuralEqualityComparer.java:36)
[junit] org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:598)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areEqual(StructuralEqualityComparer.java:92)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.checkOrAreEqual(StructuralEqualityComparer.java:163)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areAllEqual(StructuralEqualityComparer.java:145)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitTypeArgs(StructuralEqualityComparer.java:237)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitDeclared_Declared(StructuralEqualityComparer.java:214)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitDeclared_Declared(StructuralEqualityComparer.java:36)
[junit] org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:302)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areEqual(StructuralEqualityComparer.java:92)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitWildcard_Wildcard(StructuralEqualityComparer.java:383)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitWildcard_Wildcard(StructuralEqualityComparer.java:36)
[junit] org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:646)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areEqual(StructuralEqualityComparer.java:92)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.checkOrAreEqual(StructuralEqualityComparer.java:163)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areAllEqual(StructuralEqualityComparer.java:145)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitTypeArgs(StructuralEqualityComparer.java:237)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitDeclared_Declared(StructuralEqualityComparer.java:214)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.visitDeclared_Declared(StructuralEqualityComparer.java:36)
[junit] org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:302)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areEqual(StructuralEqualityComparer.java:75)
[junit] org.checkerframework.framework.type.StructuralEqualityComparer.areEqualInHierarchy(StructuralEqualityComparer.java:101)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.areEqualInHierarchy(DefaultTypeHierarchy.java:359)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.isContainedBy(DefaultTypeHierarchy.java:390)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.compareTypeArgs(DefaultTypeHierarchy.java:503)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.visitTypeArgs(DefaultTypeHierarchy.java:478)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.visitDeclared_Declared(DefaultTypeHierarchy.java:447)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.visitDeclared_Declared(DefaultTypeHierarchy.java:51)
[junit] org.checkerframework.framework.util.AtmCombo.accept(AtmCombo.java:302)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.isSubtype(DefaultTypeHierarchy.java:220)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.isSubtype(DefaultTypeHierarchy.java:170)
[junit] org.checkerframework.framework.type.DefaultTypeHierarchy.isSubtype(DefaultTypeHierarchy.java:151)
[junit] checkers.inference.InferenceVisitor.commonAssignmentCheck(InferenceVisitor.java:535)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.commonAssignmentCheck(BaseTypeVisitor.java:1858)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.checkArguments(BaseTypeVisitor.java:2216)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitMethodInvocation(BaseTypeVisitor.java:931)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitMethodInvocation(BaseTypeVisitor.java:173)
[junit] com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1477)
[junit] com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:273)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:173)
[junit] com.sun.source.util.TreeScanner.visitExpressionStatement(TreeScanner.java:243)
[junit] com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1302)
[junit] com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:273)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:173)
[junit] com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
[junit] com.sun.source.util.TreeScanner.visitBlock(TreeScanner.java:162)
[junit] com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:918)
[junit] com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:273)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:173)
[junit] com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81)
[junit] com.sun.source.util.TreeScanner.visitMethod(TreeScanner.java:144)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:507)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitMethod(BaseTypeVisitor.java:173)
[junit] com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:800)
[junit] com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:68)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:273)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.scan(BaseTypeVisitor.java:173)
[junit] com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:81)
[junit] com.sun.source.util.TreeScanner.scan(TreeScanner.java:91)
[junit] com.sun.source.util.TreeScanner.scanAndReduce(TreeScanner.java:99)
[junit] com.sun.source.util.TreeScanner.visitClass(TreeScanner.java:133)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:323)
[junit] org.checkerframework.common.basetype.BaseTypeVisitor.visitClass(BaseTypeVisitor.java:173)
[junit] com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:720)
[junit] com.sun.source.util.TreePathScanner.scan(TreePathScanner.java:50)
[junit] org.checkerframework.framework.source.SourceVisitor.visit(SourceVisitor.java:70)
[junit] org.checkerframework.framework.source.SourceChecker.typeProcess(SourceChecker.java:889)
[junit] org.checkerframework.common.basetype.BaseTypeChecker.typeProcess(BaseTypeChecker.java:452)
[junit] org.checkerframework.javacutil.AbstractTypeProcessor$AttributionTaskListener.finished(AbstractTypeProcessor.java:205)
[junit] com.sun.tools.javac.api.ClientCodeWrapper$WrappedTaskListener.finished(ClientCodeWrapper.java:681)
[junit] com.sun.tools.javac.api.MultiTaskListener.finished(MultiTaskListener.java:111)
[junit] com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1342)
[junit] com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
[junit] com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
[junit] com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
[junit] com.sun.tools.javac.main.Main.compile(Main.java:523)
[junit] com.sun.tools.javac.main.Main.compile(Main.java:381)
[junit] com.sun.tools.javac.main.Main.compile(Main.java:370)
[junit] com.sun.tools.javac.main.Main.compile(Main.java:361)
[junit] checkers.inference.CheckerFrameworkUtil.invokeCheckerFramework(CheckerFrameworkUtil.java:12)
[junit] checkers.inference.InferenceMain.startCheckerFramework(InferenceMain.java:173)
[junit] checkers.inference.InferenceMain.run(InferenceMain.java:135)
[junit] checkers.inference.InferenceMain.main(InferenceMain.java:107)

What version of the product are you using?
17f60a4 on branch: master

@smillst
Copy link
Member

smillst commented Oct 15, 2015

Also crashes on 2cdf7bc

@smillst smillst added the bug label Oct 15, 2015
@smillst
Copy link
Member

smillst commented Oct 15, 2015

Javier ran the Nullness Checker on this code and it did not crash. So, this must be some bug in the way that inference is using isSubtype.

@smillst smillst self-assigned this Nov 12, 2015
wmdietl added a commit that referenced this issue Jul 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants