From 9df1b2de4b68953a6803a341e42953f572840882 Mon Sep 17 00:00:00 2001 From: Eugene Zhuravlev Date: Mon, 16 Sep 2019 20:40:07 +0200 Subject: [PATCH] new setting for dedicated processor path to use either -processorpath or --processor-module-path compier options (IDEA-220430) GitOrigin-RevId: cbfcc53ca74348bb05a3a67d0fa85df05f3d247b --- .../compiler/CompilerConfigurationImpl.java | 6 +- .../options/AnnotationProcessorsPanel.java | 127 +++++++++--------- .../options/ProcessorProfilePanel.java | 9 +- .../ui/impl/watch/CompilingEvaluatorImpl.java | 2 +- .../org/jetbrains/jps/javac/JavacMain.java | 9 +- .../jps/incremental/java/JavaBuilder.java | 20 ++- .../AnnotationProcessingConfiguration.java | 2 + .../java/compiler/ProcessorConfigProfile.java | 2 + .../compiler/ProcessorConfigProfileImpl.java | 16 ++- .../AnnotationProcessorProfileSerializer.java | 13 +- 10 files changed, 124 insertions(+), 82 deletions(-) diff --git a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java index 1d53fe129579..9d5910df7a8e 100644 --- a/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java +++ b/java/compiler/impl/src/com/intellij/compiler/CompilerConfigurationImpl.java @@ -535,12 +535,14 @@ public class CompilerConfigurationImpl extends CompilerConfiguration implements @NotNull public List getModuleProcessorProfiles() { - return myModuleProcessorProfiles; + return Collections.unmodifiableList(myModuleProcessorProfiles); } public void setModuleProcessorProfiles(Collection moduleProfiles) { myModuleProcessorProfiles.clear(); - myModuleProcessorProfiles.addAll(moduleProfiles); + for (ProcessorConfigProfile profile : moduleProfiles) { + myModuleProcessorProfiles.add(new ProcessorConfigProfileImpl(profile)); + } myProcessorsProfilesMap = null; } diff --git a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsPanel.java b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsPanel.java index 02c097a97a8e..f1bc92873d41 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsPanel.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/AnnotationProcessorsPanel.java @@ -76,65 +76,9 @@ public class AnnotationProcessorsPanel extends JPanel { } myTree = new Tree(new MyTreeModel()); myTree.setRootVisible(false); - final JPanel treePanel = - ToolbarDecorator.createDecorator(myTree).addExtraAction(new AnActionButton("Move to", AllIcons.Actions.Forward) { - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - final MyModuleNode node = (MyModuleNode)myTree.getSelectionPath().getLastPathComponent(); - final TreePath[] selectedNodes = myTree.getSelectionPaths(); - final ProcessorConfigProfile nodeProfile = ((ProfileNode)node.getParent()).myProfile; - final List profiles = new ArrayList<>(); - profiles.add(myDefaultProfile); - profiles.addAll(myModuleProfiles); - profiles.remove(nodeProfile); - final JBPopup popup = JBPopupFactory.getInstance() - .createPopupChooserBuilder(profiles) - .setTitle("Move to") - .setItemChosenCallback((chosenProfile) -> { - final Module toSelect = (Module)node.getUserObject(); - if (selectedNodes != null) { - for (TreePath selectedNode : selectedNodes) { - final Object node1 = selectedNode.getLastPathComponent(); - if (node1 instanceof MyModuleNode) { - final Module module = (Module)((MyModuleNode)node1).getUserObject(); - if (nodeProfile != myDefaultProfile) { - nodeProfile.removeModuleName(module.getName()); - } - if (chosenProfile != myDefaultProfile) { - chosenProfile.addModuleName(module.getName()); - } - } - } - } - - final RootNode root = (RootNode)myTree.getModel().getRoot(); - root.sync(); - final DefaultMutableTreeNode node1 = TreeUtil.findNodeWithObject(root, toSelect); - if (node1 != null) { - TreeUtil.selectNode(myTree, node1); - } - }) - .createPopup(); - RelativePoint point = - e.getInputEvent() instanceof MouseEvent ? getPreferredPopupPoint() : TreeUtil.getPointForSelection(myTree); - popup.show(point); - } - - @Override - public ShortcutSet getShortcut() { - return ActionManager.getInstance().getAction("Move").getShortcutSet(); - } - - @Override - public boolean isEnabled() { - return myTree.getSelectionPath() != null - && myTree.getSelectionPath().getLastPathComponent() instanceof MyModuleNode - && !myModuleProfiles.isEmpty(); - } - }).createPanel(); + final JPanel treePanel = ToolbarDecorator.createDecorator(myTree).addExtraAction(new MoveProfileAction()).createPanel(); splitter.setFirstComponent(treePanel); myTree.setCellRenderer(new MyCellRenderer()); - myTree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { @@ -177,7 +121,6 @@ public class AnnotationProcessorsPanel extends JPanel { if (node != null) { TreeUtil.selectNode(myTree, node); } - } public ProcessorConfigProfile getDefaultProfile() { @@ -193,7 +136,7 @@ public class AnnotationProcessorsPanel extends JPanel { if (myDefaultProfile != selectedProfile) { myProfilePanel.saveTo(selectedProfile); } - return myModuleProfiles; + return Collections.unmodifiableList(myModuleProfiles); } private class MyTreeModel extends DefaultTreeModel implements EditableTreeModel{ @@ -209,7 +152,7 @@ public class AnnotationProcessorsPanel extends JPanel { @Override public boolean checkInput(String inputString) { if (StringUtil.isEmpty(inputString) || - Comparing.equal(inputString, myDefaultProfile.getName())) { + Comparing.equal(inputString, myDefaultProfile.getName())) { return false; } for (ProcessorConfigProfile profile : myModuleProfiles) { @@ -231,8 +174,8 @@ public class AnnotationProcessorsPanel extends JPanel { return null; } return StringUtil.isEmpty(inputString) - ? "Profile name shouldn't be empty" - : "Profile " + inputString + " already exists"; + ? "Profile name shouldn't be empty" + : "Profile " + inputString + " already exists"; } }); if (newProfileName != null) { @@ -382,4 +325,64 @@ public class AnnotationProcessorsPanel extends JPanel { } } + private class MoveProfileAction extends AnActionButton { + + MoveProfileAction() { + super("Move to", AllIcons.Actions.Forward); + } + + @Override + public void actionPerformed(@NotNull AnActionEvent e) { + final MyModuleNode node = (MyModuleNode)myTree.getSelectionPath().getLastPathComponent(); + final TreePath[] selectedNodes = myTree.getSelectionPaths(); + final ProcessorConfigProfile nodeProfile = ((ProfileNode)node.getParent()).myProfile; + final List profiles = new ArrayList<>(); + profiles.add(myDefaultProfile); + profiles.addAll(myModuleProfiles); + profiles.remove(nodeProfile); + final JBPopup popup = JBPopupFactory.getInstance() + .createPopupChooserBuilder(profiles) + .setTitle("Move to") + .setItemChosenCallback((chosenProfile) -> { + final Module toSelect = (Module)node.getUserObject(); + if (selectedNodes != null) { + for (TreePath selectedNode : selectedNodes) { + final Object node1 = selectedNode.getLastPathComponent(); + if (node1 instanceof MyModuleNode) { + final Module module = (Module)((MyModuleNode)node1).getUserObject(); + if (nodeProfile != myDefaultProfile) { + nodeProfile.removeModuleName(module.getName()); + } + if (chosenProfile != myDefaultProfile) { + chosenProfile.addModuleName(module.getName()); + } + } + } + } + + final RootNode root = (RootNode)myTree.getModel().getRoot(); + root.sync(); + final DefaultMutableTreeNode node1 = TreeUtil.findNodeWithObject(root, toSelect); + if (node1 != null) { + TreeUtil.selectNode(myTree, node1); + } + }).createPopup(); + RelativePoint point = e.getInputEvent() instanceof MouseEvent ? getPreferredPopupPoint() : TreeUtil.getPointForSelection(myTree); + popup.show(point); + } + + @Override + public ShortcutSet getShortcut() { + return ActionManager.getInstance().getAction("Move").getShortcutSet(); + } + + @Override + public boolean isEnabled() { + if (myModuleProfiles.isEmpty()) { + return false; + } + final TreePath selectionPath = myTree.getSelectionPath(); + return selectionPath != null && selectionPath.getLastPathComponent() instanceof MyModuleNode; + } + } } diff --git a/java/compiler/impl/src/com/intellij/compiler/options/ProcessorProfilePanel.java b/java/compiler/impl/src/com/intellij/compiler/options/ProcessorProfilePanel.java index 0621a84d953c..c05f508273f8 100644 --- a/java/compiler/impl/src/com/intellij/compiler/options/ProcessorProfilePanel.java +++ b/java/compiler/impl/src/com/intellij/compiler/options/ProcessorProfilePanel.java @@ -49,6 +49,7 @@ public class ProcessorProfilePanel extends JPanel { private final JRadioButton myRbClasspath; private final JRadioButton myRbProcessorsPath; + private final JCheckBox myCbProcessorModulePath; private final TextFieldWithBrowseButton myProcessorPathField; private final JTextField myGeneratedProductionDirField; private final JTextField myGeneratedTestsDirField; @@ -77,6 +78,7 @@ public class ProcessorProfilePanel extends JPanel { { myRbClasspath = new JRadioButton("Obtain processors from project classpath"); myRbProcessorsPath = new JRadioButton("Processor path:"); + myCbProcessorModulePath = new JCheckBox("Use --processor-module-path compiler option (for Java 9 and later)"); ButtonGroup group = new ButtonGroup(); group.add(myRbClasspath); group.add(myRbProcessorsPath); @@ -134,7 +136,9 @@ public class ProcessorProfilePanel extends JPanel { add(myRbProcessorsPath, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insetsTop(5), 0, 0)); add(myProcessorPathField, - new GridBagConstraints(1, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insets(5, 5, 0, 0), 0, 0)); + new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, JBUI.insets(5, 5, 0, 0), 0, 0)); + add(myCbProcessorModulePath, + new GridBagConstraints(0, GridBagConstraints.RELATIVE, 3, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, JBUI.insets(2, 5, 0, 0), 0, 0)); myStoreGenSourcesLabel = new JLabel("Store generated sources relative to: "); add(myStoreGenSourcesLabel, @@ -179,6 +183,7 @@ public class ProcessorProfilePanel extends JPanel { myCbEnableProcessing.setSelected(config.isEnabled()); (config.isObtainProcessorsFromClasspath()? myRbClasspath : myRbProcessorsPath).setSelected(true); + myCbProcessorModulePath.setSelected(config.isUseProcessorModulePath()); myProcessorPathField.setText(FileUtil.toSystemDependentName(config.getProcessorPath())); final String productionDirName = config.getGeneratedSourcesDirectoryName(false); @@ -201,6 +206,7 @@ public class ProcessorProfilePanel extends JPanel { profile.setEnabled(myCbEnableProcessing.isSelected()); profile.setObtainProcessorsFromClasspath(myRbClasspath.isSelected()); profile.setProcessorPath(myProcessorPathField.getText().trim()); + profile.setUseProcessorModulePath(myCbProcessorModulePath.isSelected()); final String productionDir = myGeneratedProductionDirField.getText().trim(); profile.setGeneratedSourcesDirectoryName(StringUtil.isEmpty(productionDir)? null : productionDir, false); @@ -243,6 +249,7 @@ public class ProcessorProfilePanel extends JPanel { final boolean useProcessorPath = !myRbClasspath.isSelected(); myRbClasspath.setEnabled(enabled); myRbProcessorsPath.setEnabled(enabled); + myCbProcessorModulePath.setEnabled(enabled && useProcessorPath); myProcessorPathField.setEnabled(enabled && useProcessorPath); updateTable(myProcessorPanel, myProcessorTable, enabled); updateTable(myOptionsPanel, myOptionsTable, enabled); diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java index 49007fbd304e..5a6ea383e3ec 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/CompilingEvaluatorImpl.java @@ -75,7 +75,7 @@ public class CompilingEvaluatorImpl extends CompilingEvaluator { platformClasspath.add(new File(s)); } } - JavaBuilder.addAnnotationProcessingOptions(options, profile, false); + JavaBuilder.addAnnotationProcessingOptions(options, profile); Pair runtime = BuildManager.getJavacRuntimeSdk(myProject); JavaSdkVersion buildRuntimeVersion = runtime.getSecond(); diff --git a/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java b/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java index a8c1167d7be3..ca3a92b8fb6f 100644 --- a/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java +++ b/jps/jps-builders-6/src/org/jetbrains/jps/javac/JavacMain.java @@ -100,7 +100,10 @@ public class JavacMain { if (!classpath.isEmpty()) { try { fileManager.setLocation(StandardLocation.CLASS_PATH, classpath); - if (!usingJavac && isAnnotationProcessingEnabled(_options) && !_options.contains("-processorpath")) { + if (!usingJavac && + isAnnotationProcessingEnabled(_options) && + !_options.contains("-processorpath") && + (javacBefore9 || !_options.contains("--processor-module-path"))) { // for non-javac file manager ensure annotation processor path defaults to classpath fileManager.setLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH, classpath); } @@ -135,7 +138,9 @@ public class JavacMain { if (!modulePath.isEmpty()) { try { setLocation(fileManager, "MODULE_PATH", modulePath); - if (isAnnotationProcessingEnabled(_options) && getLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH") == null) { + if (isAnnotationProcessingEnabled(_options) && + getLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH") == null && + fileManager.getLocation(StandardLocation.ANNOTATION_PROCESSOR_PATH) == null) { // default annotation processing discovery path to module path if not explicitly set setLocation(fileManager, "ANNOTATION_PROCESSOR_MODULE_PATH", modulePath); } diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java index 6cda741e2d7a..57af1b045fad 100644 --- a/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java +++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/java/JavaBuilder.java @@ -59,7 +59,8 @@ import org.jetbrains.jps.model.serialization.PathMacroUtil; import org.jetbrains.jps.service.JpsServiceManager; import org.jetbrains.jps.service.SharedThreadPool; -import javax.tools.*; +import javax.tools.Diagnostic; +import javax.tools.JavaFileObject; import java.io.File; import java.io.FileFilter; import java.io.IOException; @@ -412,7 +413,7 @@ public class JavaBuilder extends ModuleLevelBuilder { final int compilerSdkVersion = forkSdk == null ? JavaVersion.current().feature : forkSdk.getSecond(); final Pair, List> vm_compilerOptions = getCompilationOptions( - compilerSdkVersion, context, chunk, profile, hasModules, compilingTool + compilerSdkVersion, context, chunk, profile, compilingTool ); final List vmOptions = vm_compilerOptions.first; final List options = vm_compilerOptions.second; @@ -732,7 +733,6 @@ public class JavaBuilder extends ModuleLevelBuilder { CompileContext context, ModuleChunk chunk, @Nullable ProcessorConfigProfile profile, - boolean withModules, @NotNull JavaCompilingTool compilingTool) { final List compilationOptions = new ArrayList<>(); final List vmOptions = new ArrayList<>(); @@ -810,7 +810,7 @@ public class JavaBuilder extends ModuleLevelBuilder { vmOptions.addAll(extension.getOptions(compilingTool)); } - addCompilationOptions(compilerSdkVersion, compilationOptions, context, chunk, profile, withModules); + addCompilationOptions(compilerSdkVersion, compilationOptions, context, chunk, profile); return pair(vmOptions, compilationOptions); } @@ -819,13 +819,13 @@ public class JavaBuilder extends ModuleLevelBuilder { CompileContext context, ModuleChunk chunk, @Nullable ProcessorConfigProfile profile) { - addCompilationOptions(JavaVersion.current().feature, options, context, chunk, profile, false); + addCompilationOptions(JavaVersion.current().feature, options, context, chunk, profile); } private static void addCompilationOptions(int compilerSdkVersion, List options, CompileContext context, ModuleChunk chunk, - @Nullable ProcessorConfigProfile profile, boolean withModules) { + @Nullable ProcessorConfigProfile profile) { if (!options.contains("-encoding")) { final CompilerEncodingConfiguration config = context.getProjectDescriptor().getEncodingConfiguration(); final String encoding = config.getPreferredModuleChunkEncoding(chunk); @@ -852,7 +852,7 @@ public class JavaBuilder extends ModuleLevelBuilder { } } - if (addAnnotationProcessingOptions(options, profile, withModules)) { + if (addAnnotationProcessingOptions(options, profile)) { final File srcOutput = ProjectPaths.getAnnotationProcessorGeneratedSourcesOutputDir( chunk.getModules().iterator().next(), chunk.containsTests(), profile ); @@ -867,9 +867,7 @@ public class JavaBuilder extends ModuleLevelBuilder { /** * @return true if annotation processing is enabled and corresponding options were added, false if profile is null or disabled */ - public static boolean addAnnotationProcessingOptions(List options, - @Nullable AnnotationProcessingConfiguration profile, - boolean withModules) { + public static boolean addAnnotationProcessingOptions(List options, @Nullable AnnotationProcessingConfiguration profile) { if (profile == null || !profile.isEnabled()) { options.add("-proc:none"); return false; @@ -878,7 +876,7 @@ public class JavaBuilder extends ModuleLevelBuilder { // configuring annotation processing if (!profile.isObtainProcessorsFromClasspath()) { final String processorsPath = profile.getProcessorPath(); - options.add(withModules ? "--processor-module-path" : "-processorpath"); + options.add(profile.isUseProcessorModulePath() ? "--processor-module-path" : "-processorpath"); options.add(FileUtil.toSystemDependentName(processorsPath.trim())); } diff --git a/jps/model-api/src/org/jetbrains/jps/model/java/compiler/AnnotationProcessingConfiguration.java b/jps/model-api/src/org/jetbrains/jps/model/java/compiler/AnnotationProcessingConfiguration.java index 5be3dbd88c09..27ca873a5409 100644 --- a/jps/model-api/src/org/jetbrains/jps/model/java/compiler/AnnotationProcessingConfiguration.java +++ b/jps/model-api/src/org/jetbrains/jps/model/java/compiler/AnnotationProcessingConfiguration.java @@ -29,6 +29,8 @@ public interface AnnotationProcessingConfiguration { @NotNull String getProcessorPath(); + boolean isUseProcessorModulePath(); + @NotNull String getGeneratedSourcesDirectoryName(boolean forTests); diff --git a/jps/model-api/src/org/jetbrains/jps/model/java/compiler/ProcessorConfigProfile.java b/jps/model-api/src/org/jetbrains/jps/model/java/compiler/ProcessorConfigProfile.java index b65fd945ca6e..2d98472e51e7 100644 --- a/jps/model-api/src/org/jetbrains/jps/model/java/compiler/ProcessorConfigProfile.java +++ b/jps/model-api/src/org/jetbrains/jps/model/java/compiler/ProcessorConfigProfile.java @@ -38,6 +38,8 @@ public interface ProcessorConfigProfile extends AnnotationProcessingConfiguratio void setProcessorPath(@Nullable String processorPath); + void setUseProcessorModulePath(boolean isModulePath); + void setObtainProcessorsFromClasspath(boolean value); void setGeneratedSourcesDirectoryName(@Nullable String generatedSourcesDirectoryName, boolean forTests); diff --git a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.java b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.java index 518d1993c0db..964f02f8ba5a 100644 --- a/jps/model-impl/src/org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.java +++ b/jps/model-impl/src/org/jetbrains/jps/model/java/impl/compiler/ProcessorConfigProfileImpl.java @@ -32,6 +32,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile private boolean myEnabled = false; private boolean myObtainProcessorsFromClasspath = true; private String myProcessorPath = ""; + private boolean myUseProcessorModulePath = false; private final Set myProcessors = new LinkedHashSet<>(1); // empty list means all discovered private final Map myProcessorOptions = new THashMap<>(1); // key=value map of options private String myGeneratedProductionDirectoryName = DEFAULT_PRODUCTION_DIR_NAME; @@ -54,6 +55,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile myEnabled = other.isEnabled(); myObtainProcessorsFromClasspath = other.isObtainProcessorsFromClasspath(); myProcessorPath = other.getProcessorPath(); + myUseProcessorModulePath = other.isUseProcessorModulePath(); myProcessors.clear(); myProcessors.addAll(other.getProcessors()); myProcessorOptions.clear(); @@ -96,6 +98,16 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile myProcessorPath = processorPath != null? processorPath : ""; } + @Override + public void setUseProcessorModulePath(boolean useModulePath) { + myUseProcessorModulePath = useModulePath; + } + + @Override + public boolean isUseProcessorModulePath() { + return myUseProcessorModulePath; + } + @Override public boolean isObtainProcessorsFromClasspath() { return myObtainProcessorsFromClasspath; @@ -225,7 +237,8 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile : profile.myGeneratedTestsDirectoryName != null) { return false; } - if (myOutputRelativeToContentRoot != profile.myOutputRelativeToContentRoot)return false; + if (myOutputRelativeToContentRoot != profile.myOutputRelativeToContentRoot) return false; + if (myUseProcessorModulePath != profile.myUseProcessorModulePath) return false; if (!myModuleNames.equals(profile.myModuleNames)) return false; if (!myProcessorOptions.equals(profile.myProcessorOptions)) return false; if (myProcessorPath != null ? !myProcessorPath.equals(profile.myProcessorPath) : profile.myProcessorPath != null) return false; @@ -246,6 +259,7 @@ public final class ProcessorConfigProfileImpl implements ProcessorConfigProfile result = 31 * result + (myGeneratedProductionDirectoryName != null ? myGeneratedProductionDirectoryName.hashCode() : 0); result = 31 * result + (myGeneratedTestsDirectoryName != null ? myGeneratedTestsDirectoryName.hashCode() : 0); result = 31 * result + (myOutputRelativeToContentRoot ? 1 : 0); + result = 31 * result + (myUseProcessorModulePath ? 1 : 0); result = 31 * result + myModuleNames.hashCode(); return result; } diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java index 0db55010b357..a85a36d4cd77 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/java/compiler/AnnotationProcessorProfileSerializer.java @@ -35,6 +35,8 @@ public class AnnotationProcessorProfileSerializer { private static final String ENABLED = "enabled"; private static final String OPTION = "option"; private static final String MODULE = "module"; + private static final String USE_CLASSPATH = "useClasspath"; + private static final String USE_PROC_MODULE_PATH = "useProcessorModulePath"; public static void readExternal(ProcessorConfigProfile profile, Element element) { profile.setName(element.getAttributeValue(NAME, "")); @@ -73,7 +75,8 @@ public class AnnotationProcessorProfileSerializer { final Element pathElement = element.getChild("processorPath"); if (pathElement != null) { - profile.setObtainProcessorsFromClasspath(Boolean.parseBoolean(pathElement.getAttributeValue("useClasspath", "true"))); + profile.setObtainProcessorsFromClasspath(Boolean.parseBoolean(pathElement.getAttributeValue(USE_CLASSPATH, "true"))); + profile.setUseProcessorModulePath(Boolean.parseBoolean(pathElement.getAttributeValue(USE_PROC_MODULE_PATH, "false"))); final StringBuilder pathBuilder = new StringBuilder(); for (Object entry : pathElement.getChildren(ENTRY)) { final String path = ((Element)entry).getAttributeValue(NAME); @@ -136,13 +139,19 @@ public class AnnotationProcessorProfileSerializer { Element pathElement = null; if (!profile.isObtainProcessorsFromClasspath()) { pathElement = addChild(element, "processorPath"); - pathElement.setAttribute("useClasspath", Boolean.toString(profile.isObtainProcessorsFromClasspath())); + pathElement.setAttribute(USE_CLASSPATH, Boolean.toString(profile.isObtainProcessorsFromClasspath())); + if (profile.isUseProcessorModulePath()) { + pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath())); + } } final String path = profile.getProcessorPath(); if (!StringUtil.isEmpty(path)) { if (pathElement == null) { pathElement = addChild(element, "processorPath"); + if (profile.isUseProcessorModulePath()) { + pathElement.setAttribute(USE_PROC_MODULE_PATH, Boolean.toString(profile.isUseProcessorModulePath())); + } } final StringTokenizer tokenizer = new StringTokenizer(path, File.pathSeparator, false); while (tokenizer.hasMoreTokens()) {