Bläddra i källkod

Fix for Bug 3897

   add support for compiling in 1.5 mode to AJDE APIs and AJBrowser
tags/Root_AspectJ5_Development
mkersten 19 år sedan
förälder
incheckning
0e43ed55f5

+ 14
- 5
ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java Visa fil

@@ -257,8 +257,12 @@ public class CompilerAdapter {
Map optionsToSet = new HashMap();
LangUtil.throwIaxIfNull(optionsToSet, "javaOptions");

if (options.getSourceOnePointFourMode()) {
optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
if (options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)) {
optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_5);
optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
} else if (options.getSourceOnePointFourMode()
|| options.getSourceCompatibilityLevel() != null && options.getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)) {
optionsToSet.put(CompilerOptions.OPTION_Compliance, CompilerOptions.VERSION_1_4);
optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_4);
}
@@ -284,10 +288,15 @@ public class CompilerAdapter {
slVersion = CompilerOptions.VERSION_1_3;
}
// never set a lower source level than compliance level
String setCompliance = (String) optionsToSet.get( CompilerOptions.OPTION_Compliance);
if ( ! (setCompliance.equals( CompilerOptions.VERSION_1_4 )
// Mik: prepended with 1.5 check
if (sourceLevel.equals(CompilerOptions.VERSION_1_5)) {
optionsToSet.put(CompilerOptions.OPTION_Source, CompilerOptions.VERSION_1_5);
} else {
String setCompliance = (String) optionsToSet.get( CompilerOptions.OPTION_Compliance);
if ( ! (setCompliance.equals(CompilerOptions.VERSION_1_4 )
&& slVersion.equals(CompilerOptions.VERSION_1_3)) ) {
optionsToSet.put(CompilerOptions.OPTION_Source, slVersion);
optionsToSet.put(CompilerOptions.OPTION_Source, slVersion);
}
}
}

+ 26
- 8
ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java Visa fil

@@ -20,6 +20,8 @@ import javax.swing.border.Border;
import javax.swing.border.TitledBorder;

import org.aspectj.ajde.Ajde;
import org.aspectj.org.eclipse.jdt.internal.compiler.impl.CompilerOptions;

import javax.swing.*;
import java.awt.*;

@@ -71,6 +73,7 @@ public class BuildOptionsPanel extends OptionsPanel {
JTextArea incrementalNote = new JTextArea();
JLabel spacer_label = new JLabel();
JCheckBox assertions_checkBox = new JCheckBox();
JCheckBox oneFive_checkBox = new JCheckBox();
Box options_box = Box.createVerticalBox();
JCheckBox incremental_checkBox = new JCheckBox();
JCheckBox useJavac_checkBox = new JCheckBox();
@@ -95,10 +98,17 @@ public class BuildOptionsPanel extends OptionsPanel {
}
}

public void loadOptions() throws IOException {
assertions_checkBox.setSelected(
Ajde.getDefault().getBuildManager().getBuildOptions().getSourceOnePointFourMode()
);
public void loadOptions() throws IOException {
if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) {
oneFive_checkBox.setSelected(
Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_5)
);
}
if (Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel() != null) {
assertions_checkBox.setSelected(
Ajde.getDefault().getBuildManager().getBuildOptions().getSourceCompatibilityLevel().equals(CompilerOptions.VERSION_1_4)
);
}
preprocess_checkBox.setSelected(
Ajde.getDefault().getBuildManager().getBuildOptions().getPreprocessMode()
);
@@ -126,9 +136,14 @@ public class BuildOptionsPanel extends OptionsPanel {
}

public void saveOptions() throws IOException {
AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(
assertions_checkBox.isSelected()
);
if (oneFive_checkBox.isSelected()) {
AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_5);
} else if (assertions_checkBox.isSelected()) {
AjdeUIManager.getDefault().getBuildOptions().setSourceOnePointFourMode(true);
AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_4);
} else {
AjdeUIManager.getDefault().getBuildOptions().setSourceCompatibilityLevel(CompilerOptions.VERSION_1_3);
}
AjdeUIManager.getDefault().getBuildOptions().setPreprocessMode(
preprocess_checkBox.isSelected()
);
@@ -225,7 +240,9 @@ public class BuildOptionsPanel extends OptionsPanel {
incrementalNote.setText(INCREMENTAL_NOTE);
spacer_label.setText(" ");
assertions_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
assertions_checkBox.setText("Support assertions from 1.4 Java specification");
assertions_checkBox.setText("Java 1.4 source compatibility mode");
oneFive_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
oneFive_checkBox.setText("Java 1.5 source compatibility mode");
incremental_checkBox.setText("Incremental compile");
incremental_checkBox.setToolTipText("Only recompile necessary sources.");
incremental_checkBox.setFont(new java.awt.Font("Dialog", 0, 11));
@@ -243,6 +260,7 @@ public class BuildOptionsPanel extends OptionsPanel {
options_box2.add(spacer_label1, null);
compileOptions_panel.add(options_box, BorderLayout.NORTH);
options_box.add(assertions_checkBox, null);
options_box.add(oneFive_checkBox, null);
options_box.add(preprocess_checkBox, null);
options_box.add(useJavac_checkBox, null);
options_box.add(incremental_checkBox, null);

+ 1
- 0
ajde/testdata/bug-83565/.cvsignore Visa fil

@@ -0,0 +1 @@
build.ajsym

+ 0
- 1
ajde/testdata/bug-83565/build.lst Visa fil

@@ -1,3 +1,2 @@
-1.5
Bug.java

Laddar…
Avbryt
Spara