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

-Xlint:all breaks nb-javac 21 #6826

Closed
jjazzboss opened this issue Dec 10, 2023 · 12 comments · Fixed by #7366
Closed

-Xlint:all breaks nb-javac 21 #6826

jjazzboss opened this issue Dec 10, 2023 · 12 comments · Fixed by #7366
Labels
JDK bug kind:bug Bug report or fix nb-javac Run nb-javac integration tests Regression This used to work!
Milestone

Comments

@jjazzboss
Copy link
Contributor

Apache NetBeans version

Apache NetBeans 20 release candidate

What happened

I noticed that some IDE hints were not working anymore and there was this exception.

Annotation: An error occurred during parsing of 'D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\src\main\java\org\jjazz\mixconsole\PhraseViewerPanelRhythm.java'. Please report a bug against java/source and attach dump file 'C:\Users\Jerome\AppData\Roaming\NetBeans\20\var\log\PhraseViewerPanelRhythm_53.dump'.
An error occurred during parsing of 'D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\src\main\java\org\jjazz\mixconsole\PhraseViewerPanelRhythm.java'. Please report a bug against java/source and attach dump file 'C:\Users\Jerome\AppData\Roaming\NetBeans\20\var\log\PhraseViewerPanelRhythm_53.dump'.
An error occurred during parsing of 'D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\src\main\java\org\jjazz\mixconsole\PhraseViewerPanelRhythm.java'. Please report a bug against java/source and attach dump file 'C:\Users\Jerome\AppData\Roaming\NetBeans\20\var\log\PhraseViewerPanelRhythm_53.dump'.
Caused: java.lang.ClassCastException: class com.sun.tools.javac.code.Symbol$ClassSymbol cannot be cast to class com.sun.tools.javac.code.Symbol$MethodSymbol (com.sun.tools.javac.code.Symbol$ClassSymbol and com.sun.tools.javac.code.Symbol$MethodSymbol are in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @2f07572)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitApply(ThisEscapeAnalyzer.java:509)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.tree.TreeScanner.visitLambda(TreeScanner.java:271)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$visitLambda$23(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitScoped(ThisEscapeAnalyzer.java:1102)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$visitLambda$24(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitDeferred(ThisEscapeAnalyzer.java:1073)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitLambda(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1993)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.invokeUnknown(ThisEscapeAnalyzer.java:623)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.invoke(ThisEscapeAnalyzer.java:552)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitApply(ThisEscapeAnalyzer.java:530)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitExec(ThisEscapeAnalyzer.java:915)
	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1603)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.analyzeStatements(ThisEscapeAnalyzer.java:419)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$analyzeTree$6(ThisEscapeAnalyzer.java:358)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitScoped(ThisEscapeAnalyzer.java:1102)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitTopLevel(ThisEscapeAnalyzer.java:1052)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$analyzeTree$7(ThisEscapeAnalyzer.java:357)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.analyzeTree(ThisEscapeAnalyzer.java:356)
	at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:233)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1419)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1383)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
	at com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
	at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
Caused: java.lang.IllegalStateException
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
	at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:771)
	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:541)
	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:142)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:241)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:288)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
[catch] at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1420)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2035)

How to reproduce

No idea how to reproduce. The file I was editing:

/**
 * Add a "clone as user track" button which appears only when hovering component.
 */
public class PhraseViewerPanelUser extends PhraseViewerPanel
{

    private static final Icon ICON_CLONE_AS_USER_TRACK = new ImageIcon(PhraseViewerPanelUser.class.getResource("resources/CloneAsUserTrack14x14.png"));
    private FlatButton fbtn_clone;


    public PhraseViewerPanelUser(Song song, MidiMix mMix, MixChannelPanelController controller, RhythmVoice rv)
    {
        super(song, mMix, controller, rv);
        
        fbtn_clone = new FlatButton();
        fbtn_clone.setIcon(ICON_EDIT);
        fbtn_clone.addActionListener(ae -> getController().cloneAsUserPhrase(getRhythmVoice()));
        fbtn_clone.setToolTipText(ResUtil.getString(getClass(), "PhraseViewerPanel.CloneAsUserTrack.Toolip"));

        add(fbtn_clone, CornerLayout.);

    }


    // ----------------------------------------------------------------------------
    // Private methods
    // ----------------------------------------------------------------------------

 }

Did this work correctly in an earlier version?

No / Don't know

Operating System

Win 11

JDK

JDK 17 x64 Adoptium

Apache NetBeans packaging

Apache NetBeans provided installer

Anything else

Tried restarting Netbeans, had the same problem a few times. It seems that when there is eventually compilable, error is gone.

Are you willing to submit a pull request?

No

@jjazzboss jjazzboss added kind:bug Bug report or fix needs:triage Requires attention from one of the committers labels Dec 10, 2023
@jjazzboss
Copy link
Contributor Author

dump file:


/*
 *  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
 * 
 *  Copyright @2019 Jerome Lelasseux. All rights reserved.
 *
 *  This file is part of the JJazzLab software.
 *   
 *  JJazzLab is free software: you can redistribute it and/or modify
 *  it under the terms of the Lesser GNU General Public License (LGPLv3) 
 *  as published by the Free Software Foundation, either version 3 of the License, 
 *  or (at your option) any later version.
 *
 *  JJazzLab is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 *  GNU Lesser General Public License for more details.
 * 
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with JJazzLab.  If not, see <https://www.gnu.org/licenses/>
 * 
 *  Contributor(s): 
 */
package org.jjazz.mixconsole;

import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import org.jjazz.midimix.api.MidiMix;
import org.jjazz.midimix.api.UserRhythmVoice;
import org.jjazz.rhythm.api.RhythmVoice;
import org.jjazz.song.api.Song;
import org.jjazz.flatcomponents.api.FlatButton;
import org.jjazz.utilities.api.ResUtil;

/**
 * Add a "clone as user track" button which appears only when hovering component.
 */
public class PhraseViewerPanelUser extends PhraseViewerPanel
{

    private static final Icon ICON_CLONE_AS_USER_TRACK = new ImageIcon(PhraseViewerPanelUser.class.getResource("resources/CloneAsUserTrack14x14.png"));
    private FlatButton fbtn_clone;


    public PhraseViewerPanelUser(Song song, MidiMix mMix, MixChannelPanelController controller, RhythmVoice rv)
    {
        super(song, mMix, controller, rv);
        
        fbtn_clone = new FlatButton();
        fbtn_clone.setIcon(ICON_EDIT);
        fbtn_clone.addActionListener(ae -> getController().cloneAsUserPhrase(getRhythmVoice()));
        fbtn_clone.setToolTipText(ResUtil.getString(getClass(), "PhraseViewerPanel.CloneAsUserTrack.Toolip"));

        add(fbtn_clone, CornerLayout.);

    }


    // ----------------------------------------------------------------------------
    // Private methods
    // ----------------------------------------------------------------------------

 }

----- Classpath: ---------------------------------------------
bootPath: nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.base/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.compiler/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.datatransfer/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.desktop/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.instrument/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.logging/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.management/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.management.rmi/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.naming/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.net.http/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.prefs/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.rmi/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.scripting/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.se/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.security.jgss/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.security.sasl/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.smartcardio/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.sql/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.sql.rowset/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.transaction.xa/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.xml/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/java.xml.crypto/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.accessibility/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.attach/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.charsets/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.compiler/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.crypto.cryptoki/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.crypto.ec/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.crypto.mscapi/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.dynalink/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.editpad/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.hotspot.agent/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.httpserver/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.incubator.foreign/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.incubator.vector/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.ed/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.jvmstat/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.le/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.opt/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.vm.ci/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.vm.compiler/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.internal.vm.compiler.management/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jartool/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.javadoc/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jcmd/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jconsole/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jdeps/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jdi/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jdwp.agent/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jfr/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jlink/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jpackage/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jshell/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jsobject/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.jstatd/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.localedata/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.management/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.management.agent/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.management.jfr/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.naming.dns/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.naming.rmi/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.net/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.nio.mapmode/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.random/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.sctp/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.security.auth/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.security.jgss/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.unsupported/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.unsupported.desktop/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.xml.dom/;nbjrt:file:/C:/Program%20Files/Eclipse%20Adoptium/jdk-17.0.9.9-hotspot/!/modules/jdk.zipfs/
classPath: C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-activesong\4.0-BETA2-SNAPSHOT\org-jjazz-activesong-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-analytics\4.0-BETA2-SNAPSHOT\org-jjazz-analytics-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\com\mixpanel\mixpanel-java\1.5.2\mixpanel-java-1.5.2.jar;C:\Users\Jerome\.m2\repository\org\json\json\20230227\json-20230227.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-backgroundsongmusicbuilder\4.0-BETA2-SNAPSHOT\org-jjazz-backgroundsongmusicbuilder-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-base\4.0-BETA2-SNAPSHOT\org-jjazz-base-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-autoupdate-services\RELEASE200\org-netbeans-modules-autoupdate-services-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\external\updater\RELEASE200\updater-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-actions\RELEASE200\org-openide-actions-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-io\RELEASE200\org-openide-io-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-intent\RELEASE200\org-netbeans-api-intent-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-io\RELEASE200\org-netbeans-api-io-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-modules\RELEASE200\org-openide-modules-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-chordleadsheet\4.0-BETA2-SNAPSHOT\org-jjazz-chordleadsheet-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-filedirectorymanager\4.0-BETA2-SNAPSHOT\org-jjazz-filedirectorymanager-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-flatcomponents\4.0-BETA2-SNAPSHOT\org-jjazz-flatcomponents-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-guava\4.0-BETA2-SNAPSHOT\org-jjazz-guava-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\com\google\guava\guava\32.0.0-jre\guava-32.0.0-jre.jar;C:\Users\Jerome\.m2\repository\com\google\guava\failureaccess\1.0.1\failureaccess-1.0.1.jar;C:\Users\Jerome\.m2\repository\com\google\guava\listenablefuture\9999.0-empty-to-avoid-conflict-with-guava\listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar;C:\Users\Jerome\.m2\repository\com\google\code\findbugs\jsr305\3.0.2\jsr305-3.0.2.jar;C:\Users\Jerome\.m2\repository\org\checkerframework\checker-qual\3.33.0\checker-qual-3.33.0.jar;C:\Users\Jerome\.m2\repository\com\google\errorprone\error_prone_annotations\2.18.0\error_prone_annotations-2.18.0.jar;C:\Users\Jerome\.m2\repository\com\google\j2objc\j2objc-annotations\2.8\j2objc-annotations-2.8.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-harmony\4.0-BETA2-SNAPSHOT\org-jjazz-harmony-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-instrumentchooser\4.0-BETA2-SNAPSHOT\org-jjazz-instrumentchooser-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-testplayerservice\4.0-BETA2-SNAPSHOT\org-jjazz-testplayerservice-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-midi\4.0-BETA2-SNAPSHOT\org-jjazz-midi-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-midimix\4.0-BETA2-SNAPSHOT\org-jjazz-midimix-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-xstream\4.0-BETA2-SNAPSHOT\org-jjazz-xstream-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\com\thoughtworks\xstream\xstream\1.4.20\xstream-1.4.20.jar;C:\Users\Jerome\.m2\repository\io\github\x-stream\mxparser\1.2.2\mxparser-1.2.2.jar;C:\Users\Jerome\.m2\repository\xmlpull\xmlpull\1.1.3.1\xmlpull-1.1.3.1.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-musiccontrol\4.0-BETA2-SNAPSHOT\org-jjazz-musiccontrol-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-outputsynth\4.0-BETA2-SNAPSHOT\org-jjazz-outputsynth-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-startup\4.0-BETA2-SNAPSHOT\org-jjazz-startup-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-phrase\4.0-BETA2-SNAPSHOT\org-jjazz-phrase-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-colorsetmanager\4.0-BETA2-SNAPSHOT\org-jjazz-colorsetmanager-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-pianoroll\4.0-BETA2-SNAPSHOT\org-jjazz-pianoroll-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-quantizer\4.0-BETA2-SNAPSHOT\org-jjazz-quantizer-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-cl_editor\4.0-BETA2-SNAPSHOT\org-jjazz-cl_editor-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-chordsymboltextinput\4.0-BETA2-SNAPSHOT\org-jjazz-chordsymboltextinput-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-diff\4.0-BETA2-SNAPSHOT\org-jjazz-diff-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-itemrenderer\4.0-BETA2-SNAPSHOT\org-jjazz-itemrenderer-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-instrumentcomponents\4.0-BETA2-SNAPSHOT\org-jjazz-instrumentcomponents-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-rhythm\4.0-BETA2-SNAPSHOT\org-jjazz-rhythm-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-rhythmdatabase\4.0-BETA2-SNAPSHOT\org-jjazz-rhythmdatabase-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-rhythmmusicgeneration\4.0-BETA2-SNAPSHOT\org-jjazz-rhythmmusicgeneration-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-phrasetransform\4.0-BETA2-SNAPSHOT\org-jjazz-phrasetransform-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-rhythmstubs\4.0-BETA2-SNAPSHOT\org-jjazz-rhythmstubs-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-song\4.0-BETA2-SNAPSHOT\org-jjazz-song-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-songcontext\4.0-BETA2-SNAPSHOT\org-jjazz-songcontext-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-songeditormanager\4.0-BETA2-SNAPSHOT\org-jjazz-songeditormanager-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-sendopts\RELEASE200\org-netbeans-modules-sendopts-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-songstructure\4.0-BETA2-SNAPSHOT\org-jjazz-songstructure-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-ss_editor\4.0-BETA2-SNAPSHOT\org-jjazz-ss_editor-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-uisettings\4.0-BETA2-SNAPSHOT\org-jjazz-uisettings-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-uiutilities\4.0-BETA2-SNAPSHOT\org-jjazz-uiutilities-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-undomanager\4.0-BETA2-SNAPSHOT\org-jjazz-undomanager-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-upgrade\4.0-BETA2-SNAPSHOT\org-jjazz-upgrade-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\jjazzlab\org-jjazz-utilities\4.0-BETA2-SNAPSHOT\org-jjazz-utilities-4.0-BETA2-SNAPSHOT.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-annotations-common\RELEASE200\org-netbeans-api-annotations-common-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-progress\RELEASE200\org-netbeans-api-progress-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-options-api\RELEASE200\org-netbeans-modules-options-api-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-progress-nb\RELEASE200\org-netbeans-api-progress-nb-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-spi-quicksearch\RELEASE200\org-netbeans-spi-quicksearch-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-swing-outline\RELEASE200\org-netbeans-swing-outline-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-explorer\RELEASE200\org-openide-explorer-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-swing-tabcontrol\RELEASE200\org-netbeans-swing-tabcontrol-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-filesystems-nb\RELEASE200\org-openide-filesystems-nb-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-settings\RELEASE200\org-netbeans-modules-settings-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-awt\RELEASE200\org-openide-awt-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-dialogs\RELEASE200\org-openide-dialogs-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-filesystems\RELEASE200\org-openide-filesystems-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-loaders\RELEASE200\org-openide-loaders-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-scripting\RELEASE200\org-netbeans-api-scripting-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-api-templates\RELEASE200\org-netbeans-api-templates-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-editor-mimelookup\RELEASE200\org-netbeans-modules-editor-mimelookup-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-netbeans-modules-queries\RELEASE200\org-netbeans-modules-queries-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-text\RELEASE200\org-openide-text-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-nodes\RELEASE200\org-openide-nodes-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-util\RELEASE200\org-openide-util-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-util-lookup\RELEASE200\org-openide-util-lookup-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-util-ui\RELEASE200\org-openide-util-ui-RELEASE200.jar;C:\Users\Jerome\.m2\repository\org\netbeans\api\org-openide-windows\RELEASE200\org-openide-windows-RELEASE200.jar;D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\target\classes
sourcePath: D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\src\main\java;D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\target\generated-sources\annotations;D:\JeromeDocs\JJazzLab\src\JJazzLab\modules\MixConsole\src\main\resources
----- Original exception ---------------------------------------------
java.lang.IllegalStateException: java.lang.ClassCastException: class com.sun.tools.javac.code.Symbol$ClassSymbol cannot be cast to class com.sun.tools.javac.code.Symbol$MethodSymbol (com.sun.tools.javac.code.Symbol$ClassSymbol and com.sun.tools.javac.code.Symbol$MethodSymbol are in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @2f07572)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:383)
	at org.netbeans.modules.java.source.parsing.JavacParser.moveToPhase(JavacParser.java:771)
	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:541)
	at org.netbeans.modules.java.source.parsing.JavacParser.getResult(JavacParser.java:142)
	at org.netbeans.modules.parsing.impl.TaskProcessor.callGetResult(TaskProcessor.java:608)
	at org.netbeans.modules.parsing.impl.SourceCache.getResult(SourceCache.java:241)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.run(TaskProcessor.java:775)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:288)
	at org.netbeans.modules.parsing.impl.TaskProcessor$RequestPerformer.execute(TaskProcessor.java:702)
	at org.netbeans.modules.parsing.impl.TaskProcessor$CompilationJob.run(TaskProcessor.java:663)
	at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539)
	at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
	at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:1420)
	at org.netbeans.modules.openide.util.GlobalLookup.execute(GlobalLookup.java:45)
	at org.openide.util.lookup.Lookups.executeWith(Lookups.java:287)
	at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:2035)
Caused by: java.lang.ClassCastException: class com.sun.tools.javac.code.Symbol$ClassSymbol cannot be cast to class com.sun.tools.javac.code.Symbol$MethodSymbol (com.sun.tools.javac.code.Symbol$ClassSymbol and com.sun.tools.javac.code.Symbol$MethodSymbol are in unnamed module of loader org.netbeans.StandardModule$OneModuleClassLoader @2f07572)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitApply(ThisEscapeAnalyzer.java:509)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.tree.TreeScanner.visitLambda(TreeScanner.java:271)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$visitLambda$23(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitScoped(ThisEscapeAnalyzer.java:1102)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$visitLambda$24(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitDeferred(ThisEscapeAnalyzer.java:1073)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitLambda(ThisEscapeAnalyzer.java:732)
	at com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1993)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.invokeUnknown(ThisEscapeAnalyzer.java:623)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.invoke(ThisEscapeAnalyzer.java:552)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitApply(ThisEscapeAnalyzer.java:530)
	at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1816)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitExec(ThisEscapeAnalyzer.java:915)
	at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1603)
	at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:50)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.scan(ThisEscapeAnalyzer.java:462)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.analyzeStatements(ThisEscapeAnalyzer.java:419)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$analyzeTree$6(ThisEscapeAnalyzer.java:358)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitScoped(ThisEscapeAnalyzer.java:1102)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.visitTopLevel(ThisEscapeAnalyzer.java:1052)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.lambda$analyzeTree$7(ThisEscapeAnalyzer.java:357)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:179)
	at java.base/java.util.Iterator.forEachRemaining(Iterator.java:133)
	at java.base/java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1845)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at com.sun.tools.javac.comp.ThisEscapeAnalyzer.analyzeTree(ThisEscapeAnalyzer.java:356)
	at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:233)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1419)
	at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1383)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:404)
	at com.sun.tools.javac.api.JavacTaskImpl.lambda$analyze$1(JavacTaskImpl.java:379)
	at com.sun.tools.javac.api.JavacTaskImpl.invocationHelper(JavacTaskImpl.java:152)
	at com.sun.tools.javac.api.JavacTaskImpl.analyze(JavacTaskImpl.java:379)
	... 15 more

@matthiasblaesing matthiasblaesing added Regression This used to work! and removed needs:triage Requires attention from one of the committers labels Dec 10, 2023
@matthiasblaesing
Copy link
Contributor

Thank you for the report. This seems to be a bug in nb-javac and is trivially reproducible for me in a recent build from master.

To reproduce I cloned https://github.com/jjazzboss/JJazzLab, opened the main folder in NetBeans double clicked on "MixConsole" and the background scan began to flood the message log with the exception documented above.

@dbalek you created the current build of nb-javac. I wanted to have a closer look, but the version information jdk21u makes it harder than necessary to see if something was fixed between the latest build and the one you used. So

a) could you please have a look at the general problem and
b) could you please check which version you used to build nb-javac?

@mbien mbien added the nb-javac Run nb-javac integration tests label Dec 11, 2023
@mbien
Copy link
Member

mbien commented Dec 11, 2023

b) could you please check which version you used to build nb-javac?

@matthiasblaesing i was wondering about that too when i reviewed the PR, so i wrote it down: #6425 (comment) It should be 21+35

edit: I tested it with nb-javac uninstalled on JDK 21.0.1 and got the same CCE in javac
all I did was to open PhraseViewerPanel which is in JJazzLab/modules/MixConsole

@matthiasblaesing matthiasblaesing changed the title java.lang.ClassCastException: while parsing java code -Xlint:all breaks nb-javac 21 Dec 14, 2023
@matthiasblaesing
Copy link
Contributor

@mbien thank you. I was able to narrow this down some more. Maven project with source: test.zip

The reproducer holds a single class:

package test;

public class Demo  {

    public Demo() {
        Test2.test();
    }

}

This is used to trigger the error. The "knob" for checking is in the pom:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>test</groupId>
    <artifactId>test</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <release>17</release>
<!--                    <compilerArgs>
                        <arg>-Xlint:all</arg>
                    </compilerArgs>-->
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

With the shown configuration, all is fine. When opening the test project, NetBeans correctly flags Demo.java as broken and in the file Test2 is marked "Symbol not found" (there might be a different sentence, I translated from my german output).

Now remove the comment symbols around the compilerArgs element in the pom. When I do that, I get instantly an exception that looks remarkably similar to the one shown here. When you know acknowledge the exception, you can change the Test2 in Demo.java for example to Test2231. The diagnoses about the "Symbol not found" goes away, the exception pops up.

Add the comment symbols around compilerArgs again, acknowledge the exception, and diagnosis comes back, exception are not thrown anymore.

To me this looks like either a bug in the ThisEscapeAnalyser, which makes assumptions, that only hold if it is used on a tree without error or a bug in NetBeans integration, which should not call into the analyser phase of javac, when the tree has errors.

Anyway, this needs to be fixed.

@lahodaj could you please have a look at this? You worked in the area of the ThisEscapeAnalyzer and might have an idea how to fix this.

@jjazzboss I modified the main pom.xml for your project like this:

--- a/pom.xml
+++ b/pom.xml
@@ -45,7 +45,7 @@
         <jjazzlab.javac.fork>false</jjazzlab.javac.fork>
         <jjazzlab.javac.showDeprecation>true</jjazzlab.javac.showDeprecation>
         <jjazzlab.javac.showWarnings>true</jjazzlab.javac.showWarnings>
-        <jjazzlab.javac.xlint>-Xlint:all</jjazzlab.javac.xlint>
+        <jjazzlab.javac.xlint></jjazzlab.javac.xlint>
         <jjazzlab.surefire.plugin.version>3.1.0</jjazzlab.surefire.plugin.version>
         <jjazzlab.surefire.skipTests>true</jjazzlab.surefire.skipTests>
         <jjazzlab.forceEnglish>false</jjazzlab.forceEnglish>

And after switching the project to JDK 17, building it, restarting once, the project opens clean for me on a NetBeans, that is not that far from master. Given the analysis above, this seems sensible.

@lahodaj
Copy link
Contributor

lahodaj commented Dec 15, 2023

Thanks for the

@lahodaj
Copy link
Contributor

lahodaj commented Dec 15, 2023

Thanks for the report, filled:
https://bugs.openjdk.org/browse/JDK-8322159

@mbien mbien added the JDK bug label Dec 15, 2023
@matthiasblaesing
Copy link
Contributor

@lahodaj thank you, that was quick. I tested your patch in nb-javac and it seems to fix the issue. I did this:

I checked out the jdk21.0.1 tag from https://github.com/openjdk/jdk21u and applied your patch https://patch-diff.githubusercontent.com/raw/openjdk/jdk/pull/17118.patch onto that. That patch applies with just a bit of fuzziness. Is there a chance to get your patch officially backported to jdk21u? Alternatively I see the option to use the approach I used for my test. In any case I would be willing to rebuild nb-javac, if there is agreement that this would be the right way.

@mbien
Copy link
Member

mbien commented Dec 16, 2023

@matthiasblaesing nb-javac did backport patches in past, should be easy to re-enable if needed: JaroslavTulach/nb-javac@79510f4 Although it would be better if the change would be backported within openjdk itself or course, given that JDK 21 is LTS.

it would be also interesting to experiment with nb-javac artifacts at JDK 11 language/api level, since this would remove the jackpot step entirely and might allow to provide nb-javac as java module #6817. Upstream Javac is buildable on JDK 11 without code transformation as projects like https://github.com/kohlschutter/jdk.compiler.standalone demonstrate.

@mbien
Copy link
Member

mbien commented Feb 21, 2024

the bugfix was backported to JDK 22u:
openjdk/jdk22u#41

but I think the javac we merged (build 33) is older:
#6968

so NB 22 in master would be still affected as far as I see. cc @dbalek @jtulach

@lahodaj
Copy link
Contributor

lahodaj commented Feb 27, 2024

I've opened a backport to JDK 22, but then it unfortunately slipped through, so this was only fixed in JDK 22u. Yes, I think we'll need to upgrade to JDK 22u - hopefully won't be too difficult.

@mbien
Copy link
Member

mbien commented May 3, 2024

JaroslavTulach/nb-javac#22 we could potentially still get the update in

@mbien mbien linked a pull request May 7, 2024 that will close this issue
@mbien
Copy link
Member

mbien commented May 8, 2024

would be fixed by this nb-javac update #7366

@mbien mbien added this to the NB22 milestone May 16, 2024
@mbien mbien closed this as completed May 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
JDK bug kind:bug Bug report or fix nb-javac Run nb-javac integration tests Regression This used to work!
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants