There is a code snippet:

public String getInstallPath () { String commandLinePath = CommandLineSettings.getSettings().getInstallDir(); if (commandLinePath != null && !commandLinePath.isEmpty()) { return commandLinePath; } else { return getProperty("installPath", OSUtils.getDefInstallPath()); } } 

There is a call to getSettings() , which is defined as:

 @Getter private static CommandLineSettings settings; static { settings = new CommandLineSettings(); } 

When you try to get an object, the error Cannot resolve method 'getSettings()' appears. How can this be corrected? Why is there such a problem?

  • Indicate what the error is. - Yuriy SPb
  • Pointed, thank you - Dray
  • one
    I suspect that this is a summary from Project Lombok , try installing a plugin ( github ). - zRrr

1 answer 1

I don’t know what the @Getter annotation @Getter , so I’ll offer the usual variant of writing a getter for a static class field:

 private static CommandLineSettings settings; static { settings = new CommandLineSettings(); } public static CommandLineSettings getSetting() {return settings;} 

Use as you tried:

 CommandLineSettings settings = CommandLineSettings.getSettings();