[Git][java-team/libjtype-java][master] Import Debian changes 0.1.3-4.1

Andreas Tille (@tille) gitlab at salsa.debian.org
Fri Jan 24 17:41:46 GMT 2025



Andreas Tille pushed to branch master at Debian Java Maintainers / libjtype-java


Commits:
4fd30736 by Holger Levsen at 2025-01-24T18:38:51+01:00
Import Debian changes 0.1.3-4.1

libjtype-java (0.1.3-4.1) unstable; urgency=medium
.
  * Non maintainer upload by the Reproducible Builds team.
  * No source change upload to rebuild on buildd with .buildinfo files.

- - - - -


4 changed files:

- debian/changelog
- src/main/java/com/googlecode/jtype/DefaultTypeVariable.java
- src/main/java/com/googlecode/jtype/Types.java
- src/test/java/com/googlecode/jtype/DefaultTypeVariableTest.java


Changes:

=====================================
debian/changelog
=====================================
@@ -1,3 +1,10 @@
+libjtype-java (0.1.3-4.1) unstable; urgency=medium
+
+  * Non maintainer upload by the Reproducible Builds team.
+  * No source change upload to rebuild on buildd with .buildinfo files.
+
+ -- Holger Levsen <holger at debian.org>  Tue, 29 Dec 2020 03:45:27 +0100
+
 libjtype-java (0.1.3-4) unstable; urgency=medium
 
   * Team upload.


=====================================
src/main/java/com/googlecode/jtype/DefaultTypeVariable.java
=====================================
@@ -34,7 +34,7 @@ import java.util.Arrays;
  *            the type of generic declaration that declared the type variable
  * @see TypeVariable
  */
-class DefaultTypeVariable<D extends GenericDeclaration> implements Type, Serializable
+class DefaultTypeVariable<D extends GenericDeclaration> implements TypeVariable<D>, Serializable
 {
 	// constants --------------------------------------------------------------
 	
@@ -154,7 +154,16 @@ class DefaultTypeVariable<D extends GenericDeclaration> implements Type, Seriali
 			&& name.equals(typeVariable.getName())
 			&& Arrays.equals(bounds, typeVariable.getBounds());
 	}
-
+	
+	/**
+	 * {@inheritDoc}
+	 */
+	@Override
+	public String toString()
+	{
+		return TypeUtils.toString(this);
+	}
+	
 	// private methods --------------------------------------------------------
 	
 	private static boolean isValidFirstBound(Type bound)


=====================================
src/main/java/com/googlecode/jtype/Types.java
=====================================
@@ -17,15 +17,10 @@ package com.googlecode.jtype;
 
 import static com.googlecode.jtype.Utils.checkNotNull;
 
-import java.io.Serializable;
 import java.lang.reflect.GenericArrayType;
 import java.lang.reflect.GenericDeclaration;
 import java.lang.reflect.MalformedParameterizedTypeException;
-import java.lang.reflect.InvocationHandler;
-import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.ParameterizedType;
-import java.lang.reflect.Method;
-import java.lang.reflect.Proxy;
 import java.lang.reflect.Type;
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.WildcardType;
@@ -81,10 +76,7 @@ public final class Types
 	public static <D extends GenericDeclaration> TypeVariable<D> typeVariable(D declaration, String name,
 		Type... bounds)
 	{
-		return (TypeVariable<D>) Proxy.newProxyInstance(
-				Types.class.getClassLoader(),
-				new Class[]{TypeVariable.class},
-				new TypeVariableInvocationHandler(new DefaultTypeVariable<D>(declaration, name, bounds)));
+		return new DefaultTypeVariable<D>(declaration, name, bounds);
 	}
 	
 	/**
@@ -355,40 +347,4 @@ public final class Types
 		
 		return wildcardType(upperBounds, lowerBounds);
 	}
-
-	private static class TypeVariableInvocationHandler implements InvocationHandler, Serializable {
-		private static final Map<String, Method> typeVariableMethods = new HashMap<String, Method>();
-		static {
-			for (Method method : DefaultTypeVariable.class.getMethods()) {
-				if (method.getDeclaringClass().equals(DefaultTypeVariable.class)) {
-					typeVariableMethods.put(method.getName(), method);
-				}
-			}
-		}
-
-		private final DefaultTypeVariable<?> typeVariable;
-
-		public TypeVariableInvocationHandler(DefaultTypeVariable<?> typeVariable) {
-			this.typeVariable = typeVariable;
-		}
-
-		public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
-			String methodName = method.getName();
-
-			if ("toString".equals(methodName)) {
-				return TypeUtils.toString((Type) proxy);
-			}
-
-			Method typeVariableMethod = typeVariableMethods.get(methodName);
-			if (typeVariableMethod == null) {
-				throw new UnsupportedOperationException(methodName);
-			} else {
-				try {
-					return typeVariableMethod.invoke(typeVariable, args);
-				} catch (InvocationTargetException e) {
-					throw e.getCause();
-				}
-			}
-		}
-	}
 }


=====================================
src/test/java/com/googlecode/jtype/DefaultTypeVariableTest.java
=====================================
@@ -61,7 +61,7 @@ public class DefaultTypeVariableTest
 	{
 		try
 		{
-			Types.<Constructor<?>>typeVariable(null, "T", new Type[] {Number.class});
+			new DefaultTypeVariable<Constructor<?>>(null, "T", new Type[] {Number.class});
 		}
 		catch (NullPointerException exception)
 		{
@@ -76,7 +76,7 @@ public class DefaultTypeVariableTest
 	{
 		try
 		{
-			Types.<Constructor<?>>typeVariable(constructor, null, new Type[] {Number.class});
+			new DefaultTypeVariable<Constructor<?>>(constructor, null, new Type[] {Number.class});
 		}
 		catch (NullPointerException exception)
 		{
@@ -173,7 +173,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void constructorWithNullBounds()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T", null);
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T", null);
 		
 		assertEquals(constructor, typeVariable.getGenericDeclaration());
 		assertEquals("T", typeVariable.getName());
@@ -183,7 +183,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void constructorWithEmptyBounds()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[0]);
 		
 		assertEquals(constructor, typeVariable.getGenericDeclaration());
@@ -194,10 +194,10 @@ public class DefaultTypeVariableTest
 	@Test
 	public void hashCodeTest()
 	{
-		TypeVariable<Constructor<?>> typeVariable1 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class, Comparable.class});
 		
-		TypeVariable<Constructor<?>> typeVariable2 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class, Comparable.class});
 		
 		assertEquals(typeVariable1.hashCode(), typeVariable2.hashCode());
@@ -206,10 +206,10 @@ public class DefaultTypeVariableTest
 	@Test
 	public void equalsWhenEqual()
 	{
-		TypeVariable<Constructor<?>> typeVariable1 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class, Comparable.class});
 		
-		TypeVariable<Constructor<?>> typeVariable2 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class, Comparable.class});
 		
 		assertEquals(typeVariable1, typeVariable2);
@@ -218,7 +218,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void equalsWithDifferentClass()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T", null);
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T", null);
 		
 		assertFalse(typeVariable.equals(new Object()));
 	}
@@ -226,12 +226,12 @@ public class DefaultTypeVariableTest
 	@Test
 	public void equalsWithDifferentDeclarations() throws NoSuchMethodException
 	{
-		TypeVariable<Constructor<?>> typeVariable1 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class});
 		
 		Method method = getClass().getDeclaredMethod("equalsWithDifferentDeclarations");
 		
-		TypeVariable<Method> typeVariable2 = Types.<Method>typeVariable(method, "T", new Type[] {Number.class});
+		TypeVariable<Method> typeVariable2 = new DefaultTypeVariable<Method>(method, "T", new Type[] {Number.class});
 		
 		assertFalse(typeVariable1.equals(typeVariable2));
 	}
@@ -239,10 +239,10 @@ public class DefaultTypeVariableTest
 	@Test
 	public void equalsWithDifferentNames()
 	{
-		TypeVariable<Constructor<?>> typeVariable1 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class});
 		
-		TypeVariable<Constructor<?>> typeVariable2 = Types.<Constructor<?>>typeVariable(constructor, "U",
+		TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "U",
 			new Type[] {Number.class});
 		
 		assertFalse(typeVariable1.equals(typeVariable2));
@@ -251,10 +251,10 @@ public class DefaultTypeVariableTest
 	@Test
 	public void equalsWithDifferentBounds()
 	{
-		TypeVariable<Constructor<?>> typeVariable1 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable1 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class});
 		
-		TypeVariable<Constructor<?>> typeVariable2 = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable2 = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Integer.class});
 		
 		assertFalse(typeVariable1.equals(typeVariable2));
@@ -263,7 +263,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void toStringWithNoBounds()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T", null);
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T", null);
 		
 		assertEquals("T", typeVariable.toString());
 	}
@@ -271,7 +271,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void toStringWithSingleBound()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class});
 		
 		assertEquals("T extends java.lang.Number", typeVariable.toString());
@@ -280,7 +280,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void toStringWithMultipleBounds()
 	{
-		TypeVariable<Constructor<?>> typeVariable = Types.<Constructor<?>>typeVariable(constructor, "T",
+		TypeVariable<Constructor<?>> typeVariable = new DefaultTypeVariable<Constructor<?>>(constructor, "T",
 			new Type[] {Number.class, Comparable.class});
 		
 		assertEquals("T extends java.lang.Number & java.lang.Comparable", typeVariable.toString());
@@ -289,7 +289,7 @@ public class DefaultTypeVariableTest
 	@Test
 	public void serializable() throws IOException, ClassNotFoundException
 	{
-		TypeVariable<Class<?>> type = Types.<Class<?>>typeVariable(getClass(), "T",
+		TypeVariable<Class<?>> type = new DefaultTypeVariable<Class<?>>(getClass(), "T",
 			new Type[] {Number.class, Comparable.class});
 		
 		assertSerializable(type);
@@ -299,7 +299,7 @@ public class DefaultTypeVariableTest
 	
 	private static <D extends GenericDeclaration> void assertConstructor(D declaration, String name, Type... bounds)
 	{
-		TypeVariable<D> typeVariable = Types.<D>typeVariable(declaration, name, bounds);
+		TypeVariable<D> typeVariable = new DefaultTypeVariable<D>(declaration, name, bounds);
 		
 		assertEquals("Generic declaration", declaration, typeVariable.getGenericDeclaration());
 		assertEquals("Name", name, typeVariable.getName());



View it on GitLab: https://salsa.debian.org/java-team/libjtype-java/-/commit/4fd307360b8bd3ee6e1eccf3e7bd31a805b450c9

-- 
View it on GitLab: https://salsa.debian.org/java-team/libjtype-java/-/commit/4fd307360b8bd3ee6e1eccf3e7bd31a805b450c9
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20250124/c2a4bb0e/attachment.htm>


More information about the pkg-java-commits mailing list