Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [linuxtools-dev] Eclipse Build 0.6.0?

After bringing all the dependencies up to date and jumping through the usual hoops, I get hit with this:

@dot:
    [mkdir] Created dir: /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/@dot
    [javac] Compiling 140 source files to /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/@dot
    [javac] /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java:28: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
    [javac]     private T nextObject = noElement();
    [javac]                                     ^
    [javac] /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java:51: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
    [javac]             nextObject = noElement();
    [javac]                                   ^
    [javac] /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/MatchIteratorFilter.java:24: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
    [javac]     private T nextObject = noElement();
    [javac]                                     ^
    [javac] /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/MatchIteratorFilter.java:39: type parameters of <T>T cannot be determined; no unique maximal instance exists for type variable T with upper bounds T,java.lang.Object
    [javac]             nextObject = noElement();
    [javac]                                   ^
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: /var/tmp/portage/dev-util/eclipse-sdk-3.6.0/work/eclipse-build-0.6.0/build/eclipse-3.6.0-src/plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/Everything.java uses unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 4 errors

The code referenced by the errors above looks pretty sketchy.  The noElement() methods are examples of the "returns an instance of any type you think it should" anti-pattern:

    private static <T> T noElement() {
        return (T) NO_ELEMENT;
    }

Unless NO_ELEMENT is null (which it isn't), that code cannot possibly be correct.  The compiler is right to complain about it.  Please see the attached patch for a correct implementation that compiles cleanly.

After applying the attached patch, Eclipse 3.6 builds successfully on Gentoo.  :-)


On Monday, 9 August 2010, at 4:43 pm, Andrew Overholt wrote:
> * Matt Whitlock <matt@xxxxxxxxxxxxx> [2010-08-09 16:39]:
> > Linux Tools 0.6.0 has been out for a while, but there is still no Eclipse Build 0.6.0?
> 
> I'm going to tag it tomorrow :)  In the meantime, can you build from SVN
> trunk with this tarball and see if it all works on Gentoo?
> 
>   http://www.eclipse.org/downloads/download.php?file=/technology/linuxtools/eclipse-build/e36-branch/eclipse-3.6.0-src-noxpt.tar.bz2
--- plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java~	2010-02-19 12:12:49.000000000 +0000
+++ plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/CompoundIterator.java	2010-08-09 23:16:39.201246659 +0000
@@ -25,7 +25,7 @@
 	private final Iterator<? extends Object> iteratorIterator;
 	private Iterator<T> currentIterator;
 
-	private T nextObject = noElement();
+	private Object nextObject = NO_ELEMENT;
 
 	/**
 	 * Creates a compound iterator that will iterated over the elements
@@ -47,8 +47,9 @@
 		if (!positionNext())
 			throw new NoSuchElementException();
 
-		T nxt = nextObject;
-		nextObject = noElement();
+		@SuppressWarnings("unchecked")
+		T nxt = (T) nextObject;
+		nextObject = NO_ELEMENT;
 		return nxt;
 	}
 
@@ -76,9 +77,4 @@
 		nextObject = currentIterator.next();
 		return true;
 	}
-
-	@SuppressWarnings("unchecked")
-	private static <T> T noElement() {
-		return (T) NO_ELEMENT;
-	}
-}
\ No newline at end of file
+}
--- plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/MatchIteratorFilter.java~	2010-02-19 12:12:48.000000000 +0000
+++ plugins/org.eclipse.equinox.p2.metadata/src/org/eclipse/equinox/internal/p2/metadata/expression/MatchIteratorFilter.java	2010-08-09 23:20:33.572246380 +0000
@@ -21,7 +21,7 @@
 
 	private final Iterator<? extends T> innerIterator;
 
-	private T nextObject = noElement();
+	private Object nextObject = NO_ELEMENT;
 
 	public MatchIteratorFilter(Iterator<? extends T> iterator) {
 		this.innerIterator = iterator;
@@ -35,8 +35,9 @@
 		if (!positionNext())
 			throw new NoSuchElementException();
 
-		T nxt = nextObject;
-		nextObject = noElement();
+		@SuppressWarnings("unchecked")
+		T nxt = (T) nextObject;
+		nextObject = NO_ELEMENT;
 		return nxt;
 	}
 
@@ -63,9 +64,4 @@
 		}
 		return false;
 	}
-
-	@SuppressWarnings("unchecked")
-	private static <T> T noElement() {
-		return (T) NO_ELEMENT;
-	}
-}
\ No newline at end of file
+}

Back to the top