From dd95627811e0883f31991087552e080cd5119009 Mon Sep 17 00:00:00 2001 From: Rawi01 Date: Thu, 1 Feb 2024 21:20:38 +0100 Subject: [PATCH] Remove equals and now final hashCode method from test compilation unit hashCode is now final in the parent class, so we cannot override it. To avoid an NPE in the base implementation, we need to set the owner field. The PRIMARY working copy owner seems to be sufficient. --- test/core/src/lombok/RunTestsViaEcj.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/test/core/src/lombok/RunTestsViaEcj.java b/test/core/src/lombok/RunTestsViaEcj.java index 8e9369e7..352ba4e6 100644 --- a/test/core/src/lombok/RunTestsViaEcj.java +++ b/test/core/src/lombok/RunTestsViaEcj.java @@ -52,6 +52,7 @@ import org.eclipse.jdt.internal.compiler.batch.FileSystem; import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; import org.eclipse.jdt.internal.compiler.impl.CompilerOptions; import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory; +import org.eclipse.jdt.internal.core.DefaultWorkingCopyOwner; import org.eclipse.jdt.internal.core.JavaModelManager; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; @@ -308,7 +309,7 @@ public class RunTestsViaEcj extends AbstractRunTests { private final char[] mainTypeName; private TestCompilationUnitEclipse(String name, String source) { - super(null, name, null); + super(null, name, DefaultWorkingCopyOwner.PRIMARY); this.source = source.toCharArray(); char[] fileNameCharArray = getFileName(); @@ -320,14 +321,6 @@ public class RunTestsViaEcj extends AbstractRunTests { mainTypeName = CharOperation.subarray(fileNameCharArray, start, end); } - @Override public int hashCode() { - return System.identityHashCode(this); - } - - @Override public boolean equals(Object obj) { - return this == obj; - } - @Override public char[] getContents() { return source; }