Skip to content

Commit

Permalink
Set debug info parameters (-g) to javac compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
testforstephen committed Oct 8, 2024
1 parent f1c2571 commit 73d25bc
Showing 1 changed file with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,31 @@ private static void configureOptions(IJavaProject javaProject, Context context,
for (Entry<String, String> processorOption : processorOptions.entrySet()) {
options.put("-A" + processorOption.getKey() + "=" + processorOption.getValue(), Boolean.toString(true));
}

addDebugInfos(compilerOptions, options);
}

private static void addDebugInfos(Map<String, String> compilerOptions, Options options) {
boolean generateVars = CompilerOptions.GENERATE.equals(compilerOptions.get(CompilerOptions.OPTION_LocalVariableAttribute));
boolean generateLines = CompilerOptions.GENERATE.equals(compilerOptions.get(CompilerOptions.OPTION_LineNumberAttribute));
boolean generateSource = CompilerOptions.GENERATE.equals(compilerOptions.get(CompilerOptions.OPTION_SourceFileAttribute));
if (generateVars && generateLines && generateSource) {
options.put(Option.G, Boolean.toString(true));
} else if (!generateVars && !generateLines && !generateSource) {
options.put(Option.G_CUSTOM, Boolean.toString(true));
options.put(Option.G_NONE, Boolean.toString(true));
} else {
options.put(Option.G_CUSTOM, Boolean.toString(true));
if (generateVars) {
options.put("-g:vars", Boolean.toString(true));
}
if (generateLines) {
options.put("-g:lines", Boolean.toString(true));
}
if (generateSource) {
options.put("-g:source", Boolean.toString(true));
}
}
}

private static void configurePaths(JavaProject javaProject, Context context, JavacConfig compilerConfig,
Expand Down

0 comments on commit 73d25bc

Please sign in to comment.