Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Thomann2005-11-28 10:40:07 -0500
committerOlivier Thomann2005-11-28 10:40:07 -0500
commitfe167905ccc79515ce65d219dbae667a129198dd (patch)
tree717f53bdd539583c66dc2372d71859217047f03f
parent8d4c6e1c6c4bbed1ce86e17432fd480dd1f95b50 (diff)
downloadeclipse.jdt.core-fe167905ccc79515ce65d219dbae667a129198dd.tar.gz
eclipse.jdt.core-fe167905ccc79515ce65d219dbae667a129198dd.tar.xz
eclipse.jdt.core-fe167905ccc79515ce65d219dbae667a129198dd.zip
3.0 maintenance - Fix for 117495
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java28
-rw-r--r--org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties2
-rw-r--r--org.eclipse.jdt.core/buildnotes_jdt-core.html22
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java6
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java41
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java4
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java5
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java5
-rw-r--r--org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java35
13 files changed, 107 insertions, 59 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
index c465b02547..fdb1922df8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/ConstantTest.java
@@ -490,7 +490,33 @@ public void test011() {
},
"true");
}
-
+//http://bugs.eclipse.org/bugs/show_bug.cgi?id=117495
+public void test012() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " int x = 2;\n" +
+ " System.out.println(\"n: \"+(x > 1 ? 2 : 1.0));\n" +
+ " }\n" +
+ "}",
+ },
+ "n: 2.0");
+}
+//http://bugs.eclipse.org/bugs/show_bug.cgi?id=117495
+public void test013() {
+ this.runConformTest(
+ new String[] {
+ "X.java",
+ "public class X {\n" +
+ " public static void main(String[] args) {\n" +
+ " System.out.println(\"n: \"+(true ? 2 : 1.0));\n" +
+ " }\n" +
+ "}",
+ },
+ "n: 2.0");
+}
public static Class testClass() {
return ConstantTest.class;
}
diff --git a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
index afbfe49ca0..057c348270 100644
--- a/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
+++ b/org.eclipse.jdt.core/batch/org/eclipse/jdt/internal/compiler/batch/messages.properties
@@ -12,7 +12,7 @@
### compiler
compiler.name = Eclipse Java Compiler
-compiler.version = 0.455_R30x
+compiler.version = 0.456_R30x
compiler.copyright = Copyright IBM Corp 2000, 2005. All rights reserved.
### scanning
diff --git a/org.eclipse.jdt.core/buildnotes_jdt-core.html b/org.eclipse.jdt.core/buildnotes_jdt-core.html
index 80fea9f866..4fa41ccb4d 100644
--- a/org.eclipse.jdt.core/buildnotes_jdt-core.html
+++ b/org.eclipse.jdt.core/buildnotes_jdt-core.html
@@ -39,13 +39,31 @@
</td>
</tr>
</table>
+<a name="v_456_R30x"></a>
+<p><hr><h1>
+Eclipse Platform Build Notes&nbsp;<br>
+Java Development Tooling Core</h1>
+Eclipse SDK 3.0.3 Build - ? November 2005 - 3.0.3 RELEASE (R3_0_3)
+<br>Project org.eclipse.jdt.core v_456_R30x
+(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_456_R30x">cvs</a>).
+<h2>
+What's new in this drop</h2>
+<ul>
+<!--
+<li> Plugin version ID got incremented to 3.0.3.</li>
+-->
+</ul>
+
+<h3>Problem Reports Fixed</h3>
+<a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=117495">117495</a>
+Compiler: ternary ops return wrong type when condition is boolean literal
<a name="v_455_R30x"></a>
<p><hr><h1>
Eclipse Platform Build Notes&nbsp;<br>
Java Development Tooling Core</h1>
-Eclipse SDK 3.0.3 Build - 3rd Novembre 2005 - 3.0.3 RELEASE (R3_0_3)
-<br>Project org.eclipse.jdt.core v_454_R30x
+Eclipse SDK 3.0.3 Build - 3rd November 2005
+<br>Project org.eclipse.jdt.core v_455_R30x
(<a href="http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.jdt.core/?only_with_tag=v_455_R30x">cvs</a>).
<h2>
What's new in this drop</h2>
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
index e85214ff2f..2d515fa937 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/BooleanConstant.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.impl;
-import org.eclipse.jdt.internal.compiler.util.Util;
-
public class BooleanConstant extends Constant {
boolean value;
@@ -26,9 +24,7 @@ public class BooleanConstant extends Constant {
public String stringValue() {
//spec 15.17.11
- String s = Util.toBoolean(value).toString();
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString(){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
index 9a5e56a12f..bda7ffff9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ByteConstant.java
@@ -38,10 +38,7 @@ public short shortValue() {
}
public String stringValue() {
//spec 15.17.11
-
- String s = new Integer(value).toString() ;
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString(){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
index d70f8a395d..9f1616242e 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/CharConstant.java
@@ -40,10 +40,7 @@ public class CharConstant extends Constant {
}
public String stringValue() {
//spec 15.17.11
-
- String s = new Character(value).toString() ;
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString(){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java
index f82b409740..6cf305835f 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/Constant.java
@@ -1239,29 +1239,28 @@ public abstract class Constant implements TypeIds, OperatorIds {
break;
case T_String :
switch (rightId){
- case T_char : return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_float: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_double: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_byte: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_short: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_int: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_long: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_String: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_boolean: return Constant.fromValue(left.stringValue() + right.stringValue());
+ case T_char : return Constant.fromValue(left.stringValue() + String.valueOf(right.charValue()));
+ case T_float: return Constant.fromValue(left.stringValue() + String.valueOf(right.floatValue()));
+ case T_double: return Constant.fromValue(left.stringValue() + String.valueOf(right.doubleValue()));
+ case T_byte: return Constant.fromValue(left.stringValue() + String.valueOf(right.byteValue()));
+ case T_short: return Constant.fromValue(left.stringValue() + String.valueOf(right.shortValue()));
+ case T_int: return Constant.fromValue(left.stringValue() + String.valueOf(right.intValue()));
+ case T_long: return Constant.fromValue(left.stringValue() + String.valueOf(right.longValue()));
+ case T_JavaLangString: return Constant.fromValue(left.stringValue() + right.stringValue());
+ case T_boolean: return Constant.fromValue(left.stringValue() + right.booleanValue());
}
break;
- case T_null :
- switch (rightId){
- case T_char : return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_float: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_double: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_byte: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_short: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_int: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_long: return Constant.fromValue(left.stringValue() + right.stringValue());
- case T_String: return Constant.fromValue(left.stringValue() + right.stringValue());
- }
-
+// case T_null :
+// switch (rightId){
+// case T_char : return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_float: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_double: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_byte: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_short: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_int: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_long: return Constant.fromValue(left.stringValue() + right.stringValue());
+// case T_String: return Constant.fromValue(left.stringValue() + right.stringValue());
+// }
}
return NotAConstant;
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
index ca72801243..c892819314 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/DoubleConstant.java
@@ -47,9 +47,7 @@ public class DoubleConstant extends Constant {
}
public String stringValue() {
- String s = Double.toString(value);
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java
index 6caec4d663..197755feb2 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/FloatConstant.java
@@ -47,9 +47,7 @@ public class FloatConstant extends Constant {
}
public String stringValue() {
- String s = Float.toString(value);
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java
index 8d54e905f2..8588ec968c 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/IntConstant.java
@@ -48,9 +48,7 @@ public class IntConstant extends Constant {
public String stringValue() {
//spec 15.17.11
- String s = new Integer(value).toString();
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString() {
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
index c730665a57..b1ed06c2bb 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/LongConstant.java
@@ -38,10 +38,7 @@ public short shortValue() {
}
public String stringValue() {
//spec 15.17.11
-
- String s = new Long(value).toString() ;
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString(){
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
index 0bad92d828..1c2b876981 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/impl/ShortConstant.java
@@ -38,10 +38,7 @@ public short shortValue() {
}
public String stringValue() {
//spec 15.17.11
-
- String s = new Integer(value).toString() ;
- if (s == null) return "null"; //$NON-NLS-1$
- return s;
+ return String.valueOf(this.value);
}
public String toString(){
diff --git a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
index b586249919..318991560c 100644
--- a/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
+++ b/org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
@@ -58,10 +58,37 @@
package org.eclipse.jdt.core;
import java.io.File;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IMarkerDelta;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ISavedState;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.IWorkspaceRunnable;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Preferences;
+import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.formatter.DefaultCodeFormatterConstants;

Back to the top