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

Parser error when loading JML with nested ternary #3149

Closed
gewitternacht opened this issue May 30, 2023 · 1 comment
Closed

Parser error when loading JML with nested ternary #3149

gewitternacht opened this issue May 30, 2023 · 1 comment

Comments

@gewitternacht
Copy link

gewitternacht commented May 30, 2023

Description

When trying to load a file (Ternary.java) where the following nested ternary expression is used within JML, KeY opens a window titled "Parser Error" with the message "null at .../Ternary.java:2:30 Caused by: java.lang.NullPointerException" and marks true as the problem:

//@ ensures \result == (((true ? (0 + 1) : 2) > 3) ? 4 : 5);
int foo() {
    return (((true ? (0 + 1) : 2) > 3) ? 4 : 5);
}

However, this should be valid Java Syntax – when replacing
//@ ensures \result == (((true ? (0 + 1) : 2) > 3) ? 4 : 5);
with
//@ ensures \result == 5; in Ternary.java so that now only the Java Code contains the same ternary expression, the file becomes loadable and foo provable.

Note: The problem seems to occur only with this specific nesting of ternary operators and a simple expression. It does NOT occur e.g. when omitting 0 + , when using only one ternary operator or when putting the second ternary operator in place of the 4 (resulting in ((6 > 3) ? (true ? (0 + 1) : 2) : 5)) or the 5.

Reproducible

always

Steps to reproduce

  1. load Ternary.java in KeY
  2. experience a Parser Error
  3. replace the nested ternary in JML with 5
  4. load Ternary.java again
  5. note that the file is now loadable and provable

The file should be loadable and foo provable with the use of the nested ternary operator in JML – 2. should not occur.

File: Ternary.java.zip

Additional information

The "Parser Error" window contains the message

The following exception occured:

null at xxx/Ternary.java:2:30

Caused by: java.lang.NullPointerException

"Show Details" gives the following stacktrace:

null at .../Ternary.java:2:30 (.../Ternary.java:2:30)
	at de.uka.ilkd.key.speclang.njml.Translator.raiseError(Translator.java:2535)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelational_chain(Translator.java:693)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelational_chain(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$Relational_chainContext.accept(JmlParser.java:7555)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.oneOf(Translator.java:147)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelationalexpr(Translator.java:494)
	at de.uka.ilkd.key.speclang.njml.JmlParser$RelationalexprContext.accept(JmlParser.java:7344)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:562)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EqualityexprContext.accept(JmlParser.java:7270)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitAndexpr(Translator.java:544)
	at de.uka.ilkd.key.speclang.njml.JmlParser$AndexprContext.accept(JmlParser.java:7201)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExclusiveorexpr(Translator.java:529)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExclusiveorexprContext.accept(JmlParser.java:7132)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitInclusiveorexpr(Translator.java:514)
	at de.uka.ilkd.key.speclang.njml.JmlParser$InclusiveorexprContext.accept(JmlParser.java:7063)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalandexpr(Translator.java:501)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalandexprContext.accept(JmlParser.java:6994)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:482)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalorexprContext.accept(JmlParser.java:6925)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitImpliesexpr(Translator.java:446)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ImpliesexprContext.accept(JmlParser.java:6662)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEquivalenceexpr(Translator.java:426)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EquivalenceexprContext.accept(JmlParser.java:6585)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:412)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ConditionalexprContext.accept(JmlParser.java:6516)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:402)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExpressionContext.accept(JmlParser.java:6463)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPrimaryParen(Translator.java:1422)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PrimaryParenContext.accept(JmlParser.java:10027)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at de.uka.ilkd.key.speclang.njml.JmlParserBaseVisitor.visitPrimaryexpr(JmlParserBaseVisitor.java:724)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PrimaryexprContext.accept(JmlParser.java:8399)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPostfixexpr(Translator.java:854)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPostfixexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PostfixexprContext.accept(JmlParser.java:8315)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexprnotplusminus(Translator.java:840)
	at de.uka.ilkd.key.speclang.njml.JmlParser$UnaryexprnotplusminusContext.accept(JmlParser.java:8146)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.oneOf(Translator.java:147)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexpr(Translator.java:800)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$UnaryexprContext.accept(JmlParser.java:8002)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitMultexpr(Translator.java:737)
	at de.uka.ilkd.key.speclang.njml.JmlParser$MultexprContext.accept(JmlParser.java:7921)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitAdditiveexpr(Translator.java:720)
	at de.uka.ilkd.key.speclang.njml.JmlParser$AdditiveexprContext.accept(JmlParser.java:7829)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitShiftexpr(Translator.java:703)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ShiftexprContext.accept(JmlParser.java:7742)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.oneOf(Translator.java:147)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelationalexpr(Translator.java:494)
	at de.uka.ilkd.key.speclang.njml.JmlParser$RelationalexprContext.accept(JmlParser.java:7344)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:562)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EqualityexprContext.accept(JmlParser.java:7270)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitAndexpr(Translator.java:544)
	at de.uka.ilkd.key.speclang.njml.JmlParser$AndexprContext.accept(JmlParser.java:7201)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExclusiveorexpr(Translator.java:529)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExclusiveorexprContext.accept(JmlParser.java:7132)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitInclusiveorexpr(Translator.java:514)
	at de.uka.ilkd.key.speclang.njml.JmlParser$InclusiveorexprContext.accept(JmlParser.java:7063)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalandexpr(Translator.java:501)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalandexprContext.accept(JmlParser.java:6994)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:482)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalorexprContext.accept(JmlParser.java:6925)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitImpliesexpr(Translator.java:446)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ImpliesexprContext.accept(JmlParser.java:6662)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEquivalenceexpr(Translator.java:426)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EquivalenceexprContext.accept(JmlParser.java:6585)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:412)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ConditionalexprContext.accept(JmlParser.java:6516)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:402)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExpressionContext.accept(JmlParser.java:6463)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPrimaryParen(Translator.java:1422)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PrimaryParenContext.accept(JmlParser.java:10027)
	at org.antlr.v4.runtime.tree.AbstractParseTreeVisitor.visitChildren(AbstractParseTreeVisitor.java:46)
	at de.uka.ilkd.key.speclang.njml.JmlParserBaseVisitor.visitPrimaryexpr(JmlParserBaseVisitor.java:724)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PrimaryexprContext.accept(JmlParser.java:8399)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPostfixexpr(Translator.java:854)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPostfixexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PostfixexprContext.accept(JmlParser.java:8315)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexprnotplusminus(Translator.java:840)
	at de.uka.ilkd.key.speclang.njml.JmlParser$UnaryexprnotplusminusContext.accept(JmlParser.java:8146)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.oneOf(Translator.java:147)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexpr(Translator.java:800)
	at de.uka.ilkd.key.speclang.njml.Translator.visitUnaryexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$UnaryexprContext.accept(JmlParser.java:8002)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitMultexpr(Translator.java:737)
	at de.uka.ilkd.key.speclang.njml.JmlParser$MultexprContext.accept(JmlParser.java:7921)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitAdditiveexpr(Translator.java:720)
	at de.uka.ilkd.key.speclang.njml.JmlParser$AdditiveexprContext.accept(JmlParser.java:7829)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitShiftexpr(Translator.java:703)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ShiftexprContext.accept(JmlParser.java:7742)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.oneOf(Translator.java:147)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelationalexpr(Translator.java:494)
	at de.uka.ilkd.key.speclang.njml.JmlParser$RelationalexprContext.accept(JmlParser.java:7344)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:562)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEqualityexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EqualityexprContext.accept(JmlParser.java:7270)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitAndexpr(Translator.java:544)
	at de.uka.ilkd.key.speclang.njml.JmlParser$AndexprContext.accept(JmlParser.java:7201)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExclusiveorexpr(Translator.java:529)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExclusiveorexprContext.accept(JmlParser.java:7132)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitInclusiveorexpr(Translator.java:514)
	at de.uka.ilkd.key.speclang.njml.JmlParser$InclusiveorexprContext.accept(JmlParser.java:7063)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalandexpr(Translator.java:501)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalandexprContext.accept(JmlParser.java:6994)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:482)
	at de.uka.ilkd.key.speclang.njml.Translator.visitLogicalorexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$LogicalorexprContext.accept(JmlParser.java:6925)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitImpliesexpr(Translator.java:446)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ImpliesexprContext.accept(JmlParser.java:6662)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.lambda$mapOf$0(Translator.java:133)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1655)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:913)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:578)
	at de.uka.ilkd.key.speclang.njml.Translator.mapOf(Translator.java:133)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEquivalenceexpr(Translator.java:426)
	at de.uka.ilkd.key.speclang.njml.JmlParser$EquivalenceexprContext.accept(JmlParser.java:6585)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:412)
	at de.uka.ilkd.key.speclang.njml.Translator.visitConditionalexpr(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ConditionalexprContext.accept(JmlParser.java:6516)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:402)
	at de.uka.ilkd.key.speclang.njml.Translator.visitExpression(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$ExpressionContext.accept(JmlParser.java:6463)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPredicate(Translator.java:392)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PredicateContext.accept(JmlParser.java:6353)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPredornot(Translator.java:376)
	at de.uka.ilkd.key.speclang.njml.Translator.visitPredornot(Translator.java:63)
	at de.uka.ilkd.key.speclang.njml.JmlParser$PredornotContext.accept(JmlParser.java:6190)
	at de.uka.ilkd.key.speclang.njml.Translator.accept(Translator.java:128)
	at de.uka.ilkd.key.speclang.njml.Translator.visitEnsures_clause(Translator.java:2121)
	at de.uka.ilkd.key.speclang.njml.JmlParser$Ensures_clauseContext.accept(JmlParser.java:2019)
	at de.uka.ilkd.key.speclang.njml.JmlIO.interpret(JmlIO.java:178)
	at de.uka.ilkd.key.speclang.njml.JmlIO.translateTerm(JmlIO.java:188)
	at de.uka.ilkd.key.speclang.njml.JmlIO.translateTerm(JmlIO.java:214)
	at de.uka.ilkd.key.speclang.jml.translation.JMLSpecFactory.translateAndClauses(JMLSpecFactory.java:558)
	at de.uka.ilkd.key.speclang.jml.translation.JMLSpecFactory.translateEnsures(JMLSpecFactory.java:682)
	at de.uka.ilkd.key.speclang.jml.translation.JMLSpecFactory.translateEnsures(JMLSpecFactory.java:436)
	at de.uka.ilkd.key.speclang.jml.translation.JMLSpecFactory.translateJMLClauses(JMLSpecFactory.java:364)
	at de.uka.ilkd.key.speclang.jml.translation.JMLSpecFactory.createJMLOperationContracts(JMLSpecFactory.java:1144)
	at de.uka.ilkd.key.speclang.jml.JMLSpecExtractor.extractMethodSpecs(JMLSpecExtractor.java:476)
	at de.uka.ilkd.key.speclang.SLEnvInput.createSpecs(SLEnvInput.java:314)
	at de.uka.ilkd.key.speclang.SLEnvInput.read(SLEnvInput.java:361)
	at de.uka.ilkd.key.proof.init.ProblemInitializer.readEnvInput(ProblemInitializer.java:334)
	at de.uka.ilkd.key.proof.init.ProblemInitializer.prepare(ProblemInitializer.java:558)
	at de.uka.ilkd.key.proof.init.ProblemInitializer.prepare(ProblemInitializer.java:458)
	at de.uka.ilkd.key.proof.io.AbstractProblemLoader.createInitConfig(AbstractProblemLoader.java:558)
	at de.uka.ilkd.key.proof.io.AbstractProblemLoader.loadEnvironment(AbstractProblemLoader.java:318)
	at de.uka.ilkd.key.proof.io.AbstractProblemLoader.load(AbstractProblemLoader.java:276)
	at de.uka.ilkd.key.proof.io.ProblemLoader.doWork(ProblemLoader.java:64)
	at de.uka.ilkd.key.proof.io.ProblemLoader$1.doInBackground(ProblemLoader.java:117)
	at de.uka.ilkd.key.proof.io.ProblemLoader$1.doInBackground(ProblemLoader.java:110)
	at java.desktop/javax.swing.SwingWorker$1.call(SwingWorker.java:304)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at java.desktop/javax.swing.SwingWorker.run(SwingWorker.java:343)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
	at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.NullPointerException
	at de.uka.ilkd.key.java.TypeConverter.getPromotedType(TypeConverter.java:374)
	at de.uka.ilkd.key.speclang.njml.LDTHandler.build(LDTHandler.java:64)
	at de.uka.ilkd.key.speclang.njml.OverloadedOperatorHandler.build(OverloadedOperatorHandler.java:127)
	at de.uka.ilkd.key.speclang.njml.JmlTermFactory.binary(JmlTermFactory.java:391)
	at de.uka.ilkd.key.speclang.njml.Translator.visitRelational_chain(Translator.java:686)
	... 314 more

@mattulbrich
Copy link
Member

There definitely should not be an NPE. However, the type of the two arguments is different. One is \bigint the other one is int. This is how KeY got confused.

mattulbrich added a commit that referenced this issue May 30, 2023
@wadoon wadoon closed this as completed in 634ca8c May 30, 2023
wadoon added a commit that referenced this issue May 30, 2023
Ternary operators would not have a type unless the arguments have
identical types. This fix takes the promoted common type as result type.
This works in particular if \bigint and int are combined.
wadoon added a commit that referenced this issue Jun 3, 2023
* origin/main:
  Fix lockspec test
  More spammy logging removed
  Replace nbsp in proof script
  Minor changes
  TacletAppIndex lazy delta updates
  Make builtin rule app index lazy
  another review change
  optimize logging statements
  code review for #3152
  missed a line in spotless.
  spotless and documentation
  fixing an NPE bug in the error reporting of Recoder2KeY
  more test cases for exceptional jml cases
  applying spotless
  improving the fix for #3149
  fixes #3149
  fix jacoco for gradle 8
  introducing exceptional JML tests
  add code coverage
  Bump org.sonarqube from 4.0.0.2929 to 4.1.0.3113

# Conflicts:
#	key.core/src/main/java/de/uka/ilkd/key/java/Recoder2KeY.java
FliegendeWurst pushed a commit to FliegendeWurst/key that referenced this issue Jun 15, 2023
Ternary operators would not have a type unless the arguments have
identical types. This fix takes the promoted common type as result
type. This works in particular if \bigint and int are combined.
FliegendeWurst pushed a commit to FliegendeWurst/key that referenced this issue Jun 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants