]> source.dussan.org Git - aspectj.git/commitdiff
Fix for Bug 3897
authormkersten <mkersten>
Fri, 28 Jan 2005 17:25:47 +0000 (17:25 +0000)
committermkersten <mkersten>
Fri, 28 Jan 2005 17:25:47 +0000 (17:25 +0000)
   add support for compiling in 1.5 mode to AJDE APIs and AJBrowser

ajde/src/org/aspectj/ajde/internal/CompilerAdapter.java
ajde/src/org/aspectj/ajde/ui/swing/BuildOptionsPanel.java
ajde/testdata/bug-83565/.cvsignore [new file with mode: 0644]
ajde/testdata/bug-83565/build.lst

index 704cbcaf46e9351cf0c4b4d755cdd7a6882808e6..1d2221bb8d756d8a87aecc960a81755740e2a814 100644 (file)
@@ -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);         
+                               } 
                        }
                }
        
index ef1f3258439fd1b9ff379be65f16c5c6e63c0ff5..efaf3e790977e68a96fc63c0831e54bce6326436 100644 (file)
@@ -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);
diff --git a/ajde/testdata/bug-83565/.cvsignore b/ajde/testdata/bug-83565/.cvsignore
new file mode 100644 (file)
index 0000000..5e8d7b6
--- /dev/null
@@ -0,0 +1 @@
+build.ajsym
index 95c39c932aff165321980935a55123d7767545e4..5fd84111efcec82d7294b6d377adf2be8c2f1241 100644 (file)
@@ -1,3 +1,2 @@
--1.5\r
 Bug.java \r
 \r