Add version to stack traces, fix EnumWrappers in pre-1.8

This commit is contained in:
Dan Mulloy 2015-08-09 12:53:27 -04:00
parent 3166241397
commit e6c87129bd
3 changed files with 21 additions and 5 deletions

View File

@ -84,7 +84,12 @@
<version>2.5</version> <version>2.5</version>
<configuration> <configuration>
<archive> <archive>
<addMavenDescriptor>false</addMavenDescriptor> <manifestEntries>
<Main-Class>com.comphenix.protocol.Application</Main-Class>
<Implementation-Title>ProtocolLib</Implementation-Title>
<Implementation-Version>${project.version}${project.build.number}</Implementation-Version>
<Implementation-Vendor>dmulloy2</Implementation-Vendor>
</manifestEntries>
</archive> </archive>
<finalName>ProtocolLib</finalName> <finalName>ProtocolLib</finalName>
</configuration> </configuration>

View File

@ -330,8 +330,10 @@ public abstract class EnumWrappers {
} }
private static void associate(Class<?> nativeClass, Class<?> wrapperClass, EquivalentConverter<?> converter) { private static void associate(Class<?> nativeClass, Class<?> wrapperClass, EquivalentConverter<?> converter) {
FROM_NATIVE.put(nativeClass, converter); if (nativeClass != null) {
FROM_WRAPPER.put(wrapperClass, converter); FROM_NATIVE.put(nativeClass, converter);
FROM_WRAPPER.put(wrapperClass, converter);
}
} }
/** /**
@ -341,7 +343,11 @@ public abstract class EnumWrappers {
* @return The type of the enum field. * @return The type of the enum field.
*/ */
private static Class<?> getEnum(Class<?> clazz, int index) { private static Class<?> getEnum(Class<?> clazz, int index) {
return FuzzyReflection.fromClass(clazz, true).getFieldListByType(Enum.class).get(index).getType(); try {
return FuzzyReflection.fromClass(clazz, true).getFieldListByType(Enum.class).get(index).getType();
} catch (Throwable ex) {
return null; // Unsupported in this version
}
} }
public static Map<Class<?>, EquivalentConverter<?>> getFromNativeMap() { public static Map<Class<?>, EquivalentConverter<?>> getFromNativeMap() {

View File

@ -84,7 +84,12 @@
<version>2.5</version> <version>2.5</version>
<configuration> <configuration>
<archive> <archive>
<addMavenDescriptor>false</addMavenDescriptor> <manifestEntries>
<Main-Class>com.comphenix.protocol.Application</Main-Class>
<Implementation-Title>ProtocolLib</Implementation-Title>
<Implementation-Version>${project.version}${project.build.number}</Implementation-Version>
<Implementation-Vendor>dmulloy2</Implementation-Vendor>
</manifestEntries>
</archive> </archive>
<finalName>ProtocolLib</finalName> <finalName>ProtocolLib</finalName>
<outputDirectory>../../target/</outputDirectory> <outputDirectory>../../target/</outputDirectory>