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

[Patterns] Missing boxing conversion after instanceof leads to verify error #2104

Closed
srikanth-sankaran opened this issue Mar 6, 2024 · 0 comments · Fixed by #2105
Closed
Assignees
Labels
bug Something isn't working compiler Eclipse Java Compiler (ecj) related issues regression Something was broken by a previous change

Comments

@srikanth-sankaran
Copy link
Contributor

srikanth-sankaran commented Mar 6, 2024

This is a regression from #2011

We are failing to emit a boxing operation which leads to verify error in this code:

public class X {
	
	public static void foo(Boolean b) {
		
	}
	
	public static void main(String [] args) {
		Object o = new Object();
		foo(o instanceof String);
	        System.out.println("Done!");
	}
}

This code when compiled on master fails with:

Error: Unable to initialize main class X
Caused by: java.lang.VerifyError: Bad type on operand stack
Exception Details:
  Location:
    X.main([Ljava/lang/String;)V @12: invokestatic
  Reason:
    Type integer (current frame, stack[0]) is not assignable to 'java/lang/Boolean'
  Current Frame:
    bci: @12
    flags: { }
    locals: { '[Ljava/lang/String;', 'java/lang/Object' }
    stack: { integer }
  Bytecode:
    0000000: bb00 0359 b700 084c 2bc1 0014 b800 16b2
    0000010: 0018 121e b600 20b1                    

On 4.31 RC2 it prints Done! as expected.

This is also the reason behind the remaining two comparator errors in eclipse-platform/eclipse.platform.releng.aggregator#1875 (comment)

@srikanth-sankaran srikanth-sankaran self-assigned this Mar 6, 2024
@srikanth-sankaran srikanth-sankaran added bug Something isn't working compiler Eclipse Java Compiler (ecj) related issues regression Something was broken by a previous change labels Mar 6, 2024
@srikanth-sankaran srikanth-sankaran changed the title [Patterns] Mixing boxing conversion after instanceof leads to verify error [Patterns] Missing boxing conversion after instanceof leads to verify error Mar 6, 2024
srikanth-sankaran added a commit to srikanth-sankaran/eclipse.jdt.core that referenced this issue Mar 6, 2024
robstryker pushed a commit to robstryker/eclipse.jdt.core that referenced this issue Jul 18, 2024
gayanper pushed a commit to gayanper/eclipse.jdt.core that referenced this issue Sep 7, 2024
snjeza pushed a commit to snjeza/eclipse.jdt.core that referenced this issue Oct 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler Eclipse Java Compiler (ecj) related issues regression Something was broken by a previous change
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant