summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorahaase2008-02-26 04:02:00 (EST)
committer ahaase2008-02-26 04:02:00 (EST)
commit50c51ce83b405a7bd2bc0b39af85fc4556d88fc8 (patch)
tree506a3b73b19f6372dd516a98e4ceea78040cc2d7
parent1ad5eb32d75763b7ab79d7aee480c05b657a51b4 (diff)
downloadorg.eclipse.xpand-50c51ce83b405a7bd2bc0b39af85fc4556d88fc8.zip
org.eclipse.xpand-50c51ce83b405a7bd2bc0b39af85fc4556d88fc8.tar.gz
org.eclipse.xpand-50c51ce83b405a7bd2bc0b39af85fc4556d88fc8.tar.bz2
removed dependency on JDK 6
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java9
-rw-r--r--plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/ResourceToList.java2
2 files changed, 8 insertions, 3 deletions
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
index c4dd2ba..3511da3 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/CollectionHelper.java
@@ -10,8 +10,8 @@ Contributors:
*/
package org.eclipse.xtend.backend.util;
+import java.lang.reflect.Array;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
@@ -20,8 +20,13 @@ import java.util.List;
* @author Arno Haase (http://www.haase-consulting.com)
*/
public final class CollectionHelper {
+
+ @SuppressWarnings("unchecked")
public static<T> T[] withoutFirst (T[] o) {
- return Arrays.copyOfRange (o, 1, o.length);
+ final Class<?> memberClass = o.getClass().getComponentType();
+ final T[] result = (T[]) Array.newInstance (memberClass, o.length - 1);
+ System.arraycopy (o, 1, result, 0, result.length);
+ return result;
}
public static<T> List<T> withoutFirst (List<T> o) {
diff --git a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/ResourceToList.java b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/ResourceToList.java
index 04b4da8..08eddcc 100644
--- a/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/ResourceToList.java
+++ b/plugins/org.eclipse.xtend.backend/src/org/eclipse/xtend/backend/util/ResourceToList.java
@@ -52,7 +52,7 @@ public final class ResourceToList {
private void processLine (String line) {
line = stripComment (line);
line = line.trim ();
- if (line.isEmpty())
+ if (line.length() == 0)
return;
_result.add (line);