Ranides Atterwim 4 年 前
コミット
8fb51d9335

+ 0 - 1
assira.core/src/main/java/net/ranides/assira/collection/query/CQueryAbstract.java

@@ -240,7 +240,6 @@ public abstract class CQueryAbstract<T> implements CQuery<T>, CQueryFeatures {
 
     @Override
     public CQuery<T> skip(int n) {
-        // todo implement CQSkip instead of CQSlice
         return slice(n, Integer.MAX_VALUE);
     }
 

+ 0 - 2
assira.core/src/main/java/net/ranides/assira/math/NumberTraits.java

@@ -5,8 +5,6 @@ import lombok.experimental.UtilityClass;
 @UtilityClass
 public class NumberTraits {
 
-    // TODO NumberTraits
-
     public static boolean isOdd(int value) {
         return value % 2 == 1;
     }

+ 0 - 1
assira.core/src/main/java/net/ranides/assira/reflection/impl/AClassLoader.java

@@ -45,7 +45,6 @@ public class AClassLoader extends ClassLoader implements IClassLoader, Serializa
 
     @Override
     public final IClass<?> defineIClass(byte[] bytecode) {
-        // TODO new ClassReader(bytecode).getClassName() is slow?
         String classname = new ClassReader(bytecode).getClassName().replace('/', '.');
         return defineIClass(classname, bytecode);
     }

+ 33 - 33
assira.core/src/test/java/net/ranides/assira/reflection/impl/RMethodTest.java

@@ -13,8 +13,10 @@ import net.ranides.assira.text.ResolveFormatUtils;
 
 import org.hamcrest.CoreMatchers;
 import org.junit.Assume;
+import org.junit.AssumptionViolatedException;
 import org.junit.Test;
 
+import java.lang.reflect.Type;
 import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
@@ -31,39 +33,37 @@ public class RMethodTest {
     
     private static final String RECORD_TYPE = "net.ranides.test.mockup.reflection.ForRMethod<java.lang.Float>$Record<java.lang.Double>";
     
-//    @Test
-//    public void testJVM1() {
-//        try {
-//            itestJVM1();
-//        } catch (java.lang.reflect.GenericSignatureFormatError e) {
-//            throw new AssumptionViolatedException("Detected JVM bug.", e);
-//        }
-//    }
-
-//    private void itestJVM1() {
-//        // @todo (assira #9) JVM BUG :)
-//
-//        // to zadziała
-//        ForRMethod<Float> parent1 = new ForRMethod<Float>(){};
-//        Object record1 = parent1.new Record<Double>(){};
-//        Type type1 = record1.getClass().getGenericSuperclass();
-//
-//        Assume.assumeThat(type1.toString(), CoreMatchers.equalTo(RECORD_TYPE));
-//
-//        // Wyjątek jaki leci jest zaskakujący:
-//        // java.lang.reflect.GenericSignatureFormatError: Signature Parse error:
-//        //      ; expected in signature of type variable named
-//        //      Remaining input: <captured wildcard>;>.Record<Ljava/lang/Double;>;
-//
-//        // Nie nasza wina. Kompilator coś sobie źle generuje i JVM samo tego sparsować sobie nie potrafi.
-//
-//        ForRMethod<? super Float> parent2 = new ForRMethod<Float>(){};
-//        Object record2 = parent2.new Record<Double>(){};
-//        Type type2 = record2.getClass().getGenericSuperclass();
-//
-//        Assume.assumeThat(type2.toString(), CoreMatchers.equalTo(RECORD_TYPE));
-//
-//    }
+    @Test
+    public void testJVM1() {
+        try {
+            itestJVM1();
+        } catch (java.lang.reflect.GenericSignatureFormatError e) {
+            throw new AssumptionViolatedException("Detected JVM bug.", e);
+        }
+    }
+
+    private void itestJVM1() {
+        // this declarations are correct
+        ForRMethod<Float> parent1 = new ForRMethod<Float>(){};
+        Object record1 = parent1.new Record<Double>(){};
+        Type type1 = record1.getClass().getGenericSuperclass();
+
+        Assume.assumeThat(type1.toString(), CoreMatchers.equalTo(RECORD_TYPE));
+
+        // Exception thrown from here is very suprising:
+        // java.lang.reflect.GenericSignatureFormatError: Signature Parse error:
+        //      ; expected in signature of type variable named
+        //      Remaining input: <captured wildcard>;>.Record<Ljava/lang/Double;>;
+
+        // It is not our fault. Compiler generates something wrong and JVM itself can parse it.
+
+        ForRMethod<? super Float> parent2 = new ForRMethod<Float>(){};
+        Object record2 = parent2.new Record<Double>(){};
+        Type type2 = record2.getClass().getGenericSuperclass();
+
+        Assume.assumeThat(type2.toString(), CoreMatchers.equalTo(RECORD_TYPE));
+
+    }
     
     @Test
     public void testJVM2() {