Bug 569916 - Sorting.sortSuper(...) throws NullPointerException
Summary: Sorting.sortSuper(...) throws NullPointerException
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.19   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2020-12-24 10:12 EST by Ivan Ivan CLA
Modified: 2023-01-20 14:29 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ivan Ivan CLA 2020-12-24 10:12:21 EST
Hey, the issue happens in the latest JDT core
    implementation 'org.eclipse.jdt:org.eclipse.jdt.core:latest.release'
    implementation 'org.eclipse.jdt:org.eclipse.jdt.ui:latest.release'

When I try to compile a class:

package p000;
public final class Test implements java.lang.Object, p000.DoesNotExist {}

I get the following crash:

Exception in thread "main" java.lang.NullPointerException
	at org.eclipse.jdt.internal.compiler.util.Sorting.sortSuper(Sorting.java:75)
	at org.eclipse.jdt.internal.compiler.util.Sorting.sort(Sorting.java:56)
	at org.eclipse.jdt.internal.compiler.util.Sorting.sortTypes(Sorting.java:44)
	at org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.computeInheritedMethods(MethodVerifier.java:627)
	at org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.computeInheritedMethods(MethodVerifier.java:514)
	at org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.verify(MethodVerifier.java:1012)
	at org.eclipse.jdt.internal.compiler.lookup.MethodVerifier15.verify(MethodVerifier15.java:1022)
	at org.eclipse.jdt.internal.compiler.lookup.MethodVerifier.verify(MethodVerifier.java:1022)
	at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.verifyMethods(SourceTypeBinding.java:3357)
	at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.verifyMethods(CompilationUnitScope.java:937)
	at org.eclipse.jdt.internal.compiler.Compiler.process(Compiler.java:899)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:1041)
	at org.eclipse.jdt.core.dom.CompilationUnitResolver.resolve(CompilationUnitResolver.java:661)
	at org.eclipse.jdt.core.dom.ASTParser.createASTs(ASTParser.java:1001)
Comment 1 Ivan Ivan CLA 2020-12-25 15:35:43 EST
Parser options:

ASTParser astParser = ASTParser.newParser(AST.JLS15);
astParser.setResolveBindings(true);
astParser.setStatementsRecovery(true);
astParser.setBindingsRecovery(true);
astParser.setKind(ASTParser.K_COMPILATION_UNIT);
astParser.setEnvironment(new String[0], new String[0], null, false);
		
Map<String, String> options = JavaCore.getDefaultOptions();
options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_14);
options.put(JavaCore.COMPILER_SOURCE, JavaCore.VERSION_14);
options.put(JavaCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaCore.VERSION_14);
astParser.setCompilerOptions(options);
Comment 2 Andrey Loskutov CLA 2021-01-02 12:03:17 EST
I guess "Test implements java.lang.Object" is not intentional, or how is this supposed to be compiled?

Beside this, if you would provide a simple (full) test case to reproduce the problem, it would be great.
Comment 3 Ivan Ivan CLA 2021-01-02 16:17:49 EST
Andrey,

The provided example that causes JDT to crash is full:

package p000;
public final class Test implements java.lang.Object, p000.DoesNotExist {}

(you need to create file p000/Test.java)

All you need to do is to launch JDT from sources (like in "Use it to creates ast" from bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=559849), but you need to set "includeRunningVMBootclasspath" to "false" and don't include any JARs
Comment 4 Eclipse Genie CLA 2023-01-20 14:29:41 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.