You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
Trying to use a ternary operator with arguments that are method references, as parameter to an @ExtensionMethod did not work.
foobar.setPredicate(value?Bar::isBaz:null);
To Reproduce
public class FooExtensions<T> {}
public static <T> void setPredicate(Foo<T> foo, SerializablePredicate<T> predicate) {}
}
public class Foo<T> {}
@Getter
@Setter
public class Bar {
boolean baz;
}
@ExtensionMethod(FooExtensions.class)
public class Test {
void setPredicate(Foo<Bar> foobar, boolean value) {
foobar.setPredicate(value?Bar::isBaz:null);
}
}
Compiling with javac succeeds.
As a workaround for Eclipse, replacing the ternary expression with separate calls foobar.setPredicate(Bar::isBaz); and foobar.setPredicate(null); compiles fine (per #2741).
If you have stack traces or error messages please include all of them
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jdt.ui".
Java Model Exception: java.lang.NullPointerException
!ENTRY org.eclipse.jdt.ui 4 0 2022-03-28 16:50:09.417
!MESSAGE Error in JDT Core during reconcile
!STACK 1
Java Model Exception: java.lang.NullPointerException
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:326)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:348)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:193)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:740)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:806)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1319)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:94)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107)
at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210)
Caused by: java.lang.NullPointerException
Caused by: java.lang.NullPointerException
!SUBENTRY 1 org.eclipse.jdt.core 4 1005 2022-03-28 16:50:09.417
!MESSAGE java.lang.NullPointerException
!STACK 0
java.lang.NullPointerException
Expected behavior
I expect foobar.setPredicate(value?Bar::isBaz:null); to compile when using Eclipse 2021-09.
Version info (please complete the following information):
Lombok version: 1.18.22
Platform: Eclipse 2021-09 (4.21.0)
The text was updated successfully, but these errors were encountered:
Describe the bug
Trying to use a ternary operator with arguments that are method references, as parameter to an
@ExtensionMethod
did not work.To Reproduce
Compiling with javac succeeds.
As a workaround for Eclipse, replacing the ternary expression with separate calls
foobar.setPredicate(Bar::isBaz);
andfoobar.setPredicate(null);
compiles fine (per #2741).Expected behavior
I expect
foobar.setPredicate(value?Bar::isBaz:null);
to compile when using Eclipse 2021-09.Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: