Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

false alert from a check in the annotation processor prevents generation of Koloboke implementation #52

Open
robvarga opened this issue Nov 5, 2016 · 0 comments

Comments

@robvarga
Copy link

robvarga commented Nov 5, 2016

The following test case shows the problem (the Koloboke annotation processor incorrectly complains for SubClass when it correctly doesn't complain for Implementor).

package kolobokebug;

import com.koloboke.collect.map.LongObjMap;
import com.koloboke.compile.KolobokeMap;

public class TestCase {
    public interface Iface<P1, P2> {
        P2 methodWithIndependentTypeVariables(P1 p1, P2 p2);
    }
    
    @KolobokeMap
    static abstract class Implementor<P2> implements LongObjMap<Object>, Iface<Integer, P2> {
        @Override
        public P2 methodWithIndependentTypeVariables(Integer p1, P2 p2) {
            return null;
        }
    }
    
    @KolobokeMap
    static abstract class SubClass<V> extends Implementor<V> {
//        @Override
//        public V methodWithIndependentTypeVariables(Integer p1, V p2) {
//            return super.methodWithIndependentTypeVariables(p1, p2);
//        }
    }
}

Interestingly when removing type variable P1 from the method signature, it fixes the problem, so it may be that the problem only happens with methods with a partially bound type defined type variable set.

If we uncomment the redefinition method, it also fixes the problem as then the method is defined in the @KolobokeMap annotated class not a superclass of it, but the whole point of it was to be able to implement these methods only in the super-type of the annotated type.

I used Eclipse for JEE Developers 4.6.1 (whatever it updated itself to), JBoss Maven Integration APT plugin 1.3.0.201610261805

Maven dependencies:

	<dependencies>
		<dependency>
			<groupId>com.koloboke</groupId>
			<artifactId>koloboke-compile</artifactId>
			<version>0.5.1</version>
			<scope>provided</scope>
		</dependency>
		<dependency>
			<groupId>com.koloboke</groupId>
			<!-- `jdk6-7` instead of `jdk8` if you use Java 6 or 7 -->
			<artifactId>koloboke-impl-common-jdk8</artifactId>
			<version>1.0.0</version>
		</dependency>
	</dependencies>

.factorypath file:

<factorypath>
    <factorypathentry kind="VARJAR" id="M2_REPO/com/koloboke/koloboke-compile/0.5.1/koloboke-compile-0.5.1.jar" enabled="true" runInBatchMode="false"/>
    <factorypathentry kind="VARJAR" id="M2_REPO/com/koloboke/koloboke-impl-common-jdk8/1.0.0/koloboke-impl-common-jdk8-1.0.0.jar" enabled="true" runInBatchMode="false"/>
    <factorypathentry kind="VARJAR" id="M2_REPO/com/koloboke/koloboke-api-jdk8/1.0.0/koloboke-api-jdk8-1.0.0.jar" enabled="true" runInBatchMode="false"/>
    <factorypathentry kind="PLUGIN" id="org.eclipse.jst.ws.annotations.core" enabled="true" runInBatchMode="false"/>
</factorypath>

.classpath file:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" output="target/classes" path="src/main/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" output="target/test-classes" path="src/test/java">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
		<attributes>
			<attribute name="maven.pomderived" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="src" path="target/generated-sources/annotations">
		<attributes>
			<attribute name="optional" value="true"/>
			<attribute name="maven.pomderived" value="true"/>
			<attribute name="ignore_optional_problems" value="true"/>
			<attribute name="m2e-apt" value="true"/>
		</attributes>
	</classpathentry>
	<classpathentry kind="output" path="target/classes"/>
</classpath>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant