Coder Social home page Coder Social logo

Comments (14)

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

The exception is thrown on startup, re-producable with master branch.

from recaf.

Col-E avatar Col-E commented on August 18, 2024

Looks like it's an osx LAF issue in combination with how I handle applying themes. According to https://lists.apple.com/archives/java-dev/2010/Mar/msg00181.html

You are using the Aqua Look and Feel's ScreenMenuBar, without having Aqua actually installed: this is not supported.

I think the solution would be calling UIManager's install(lafName, lafClass) with the com/apple/laf/AquaLookAndFeel class for osx users. Hopefully a small plugin can fix this.

from recaf.

Col-E avatar Col-E commented on August 18, 2024

I pushed a commit to master which shifts the order of displaying the UI to after plugins load. Can you build recaf from it and plop this plugin (jar inside the zip) into your <recaf>/plugins folder?

Plugin contents:

public class OsxThemeFix implements Plugin {
   @Override
   public void init() {
      SwingUtilities.invokeLater(new Runnable() {            
         @Override
         public void run() {
            UIManager.installLookAndFeel("Aqua", "com.apple.laf.AquaLookAndFeel");
         }
      });
   }
}

OsxThemeFix.zip

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

The error stays the same

%> ls plugins/
./  ../  OsxThemeFix.jar
%> mvn clean package
...
%> java -jar target/recaf-0.9-jar-with-dependencies.jar
[INFO:2/1/18 11:21 AM] Setting up Recaf
[INFO:2/1/18 11:21 AM]    Loading config
[INFO:2/1/18 11:21 AM]       Loading config: ASM
[INFO:2/1/18 11:21 AM]       Loading config: Theme
[INFO:2/1/18 11:21 AM]       Loading config: UserInterface
[window.method.opcode.edit, window.method.opcode.new.before, window.method.opcode.new.after, window.method.opcode.move.up, window.method.opcode.move.down, window.method.opcode.gotodef, window.method.opcode.gotojump, window.method.opcode.saveblock, window.method.opcode.insertblock, window.method.opcode.remove]
[window.member.decompile, window.member.vars, window.member.editopcodes, window.member.catch, window.member.verify, window.member.define, window.member.search, window.member.add, window.member.remove]
[INFO:2/1/18 11:21 AM]       Loading config: CodeBlocks
[INFO:2/1/18 11:21 AM]       Loading config: Agent
[FINE:2/1/18 11:21 AM]    Loading language from: /resources/lang/en.json
[INFO:2/1/18 11:21 AM]    Loading attach api
[INFO:2/1/18 11:21 AM]    Creating UI
[INFO:2/1/18 11:21 AM]    Loading plugins
[INFO:2/1/18 11:21 AM]    Displaying UI
[INFO:2/1/18 11:21 AM] Finished setup
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at com.apple.laf.AquaMenuPainter.paintMenuBarBackground(AquaMenuPainter.java:145)
	at com.apple.laf.AquaMenuBarUI.paint(AquaMenuBarUI.java:74)
	at javax.swing.plaf.ComponentUI.update(ComponentUI.java:161)
	at javax.swing.JComponent.paintComponent(JComponent.java:780)
	at javax.swing.JComponent.paint(JComponent.java:1056)
	at javax.swing.JComponent.paintChildren(JComponent.java:889)
	at javax.swing.JComponent.paint(JComponent.java:1065)
        ...

from recaf.

Col-E avatar Col-E commented on August 18, 2024

Ok then it looks like I have to re-evaluate how theme's are applied. The plugin probably doesn't work because there's still a delay in setting the theme (which was put in place due to a non-delayed execution resulting in incomplete theme-application). I can't easily test this alone since I don't have any apple computers.

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

No problem, it's not a fatal error anyway. Perhaps this would help https://stackoverflow.com/questions/23201030/what-is-a-look-and-feel-that-is-compatible-with-mac

from recaf.

Col-E avatar Col-E commented on August 18, 2024

If you put UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); at the beginning on main does the exception get raised?

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

In main()

	public static void main(String[] args) {
		try {
			System.out.println("before setLookAndFeel");
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			System.out.println("after setLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		LaunchParams params = new LaunchParams();
		start(args, params);
	}

Output

%> java -jar target/recaf-0.9-jar-with-dependencies.jar
before setLookAndFeel
after setLookAndFeel
[INFO:2/1/18 2:54 PM] Setting up Recaf
[INFO:2/1/18 2:54 PM]    Loading config

from recaf.

Col-E avatar Col-E commented on August 18, 2024

Does that mean adding the system LAF to main resolves the exception?

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

Yes, set LAF in main works, no exception :-P

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel("javax.swing.plaf.nimbus.NimbusLookAndFeel");
		} catch (Exception e) {
			e.printStackTrace();
		}
		LaunchParams params = new LaunchParams();
		start(args, params);
	}

from recaf.

Col-E avatar Col-E commented on August 18, 2024

OK I'll work it into a commit later today.

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

It works by now but I found another bug. There are three "Java Programs" in the file dialog ...

screenshot 2018-02-02 at 14 47 05

from recaf.

Col-E avatar Col-E commented on August 18, 2024

image

Should be put under an issue of it's own but it looks fine on my end.

from recaf.

CaledoniaProject avatar CaledoniaProject commented on August 18, 2024

Looks like a compiler cache issue, the problem is now gone ...

from recaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.