java.lang.reflect.MalformedParametersException#java.lang.Class源码实例Demo

下面列出了java.lang.reflect.MalformedParametersException#java.lang.Class 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openjdk-8-source   文件: Basic.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getDeclaredField(field1);
    Field f2 = klass.getDeclaredField(field2);

    if (isStatic(f1) != isStatic(f2)) {
        return true; // these guys are in naturally disjoint locations
    }

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码2 项目: TencentKona-8   文件: Basic.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getDeclaredField(field1);
    Field f2 = klass.getDeclaredField(field2);

    if (isStatic(f1) != isStatic(f2)) {
        return true; // these guys are in naturally disjoint locations
    }

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码3 项目: gemfirexd-oss   文件: ClassSize.java
private static int estimateBaseFromCatalog( Class cls, boolean addToCatalog)
 {
     if( dummyCatalog)
         return 0;
     
     if( SanityManager.DEBUG)
SanityManager.ASSERT( catalog != null, "The class size catalog could not be initialized.");
     
     int[] coeff = (int[]) catalog.get( cls.getName());
     if( coeff == null)
     {
         try
         {
             coeff = getSizeCoefficients( cls);
         }
         catch( Throwable t)
         {
             if( noGuess)
                 return -2;
             coeff = wildGuess;
         }
         if( addToCatalog)
             catalog.put( cls.getName(), coeff);
     }
     return estimateBaseFromCoefficients( coeff);
 }
 
源代码4 项目: openjdk-jdk9   文件: XMLFactoryHelper.java
public static Object instantiateXMLService(String serviceName) throws Exception {
    ClassLoader backup = Thread.currentThread().getContextClassLoader();
    try {
        // set thread context class loader to module class loader
        Thread.currentThread().setContextClassLoader(XMLFactoryHelper.class.getClassLoader());
        if (serviceName.equals("org.xml.sax.XMLReader"))
            return XMLReaderFactory.createXMLReader();
        else if (serviceName.equals("javax.xml.validation.SchemaFactory"))
            return Class.forName(serviceName).getMethod("newInstance", String.class)
                    .invoke(null, W3C_XML_SCHEMA_NS_URI);
        else
            return Class.forName(serviceName).getMethod("newInstance").invoke(null);
    } finally {
        Thread.currentThread().setContextClassLoader(backup);
    }

}
 
源代码5 项目: manifold   文件: GqlParentType.java
private Class<?> findJsonEquivalent( String scalarName )
{
  switch( scalarName )
  {
    case "Time":
    case "LocalTime":
      return findFormatType( "time" );
    case "Date":
    case "LocalDate":
      return findFormatType( "date" );
    case "DateTime":
    case "LocalDateTime":
      return findFormatType( "date-time" );
    case "Instant":
      return findFormatType( "utc-millisec" );
    case "Base64":
      return findFormatType( "binary" );
    case "Binary":
    case "Octet":
      return findFormatType( "byte" );
  }
  return String.class;
}
 
源代码6 项目: hottub   文件: BadClassFiles.java
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
源代码7 项目: hottub   文件: Basic.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getDeclaredField(field1);
    Field f2 = klass.getDeclaredField(field2);

    if (isStatic(f1) != isStatic(f2)) {
        return true; // these guys are in naturally disjoint locations
    }

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码8 项目: openjdk-jdk9   文件: Basic.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getDeclaredField(field1);
    Field f2 = klass.getDeclaredField(field2);

    if (isStatic(f1) != isStatic(f2)) {
        return true; // these guys are in naturally disjoint locations
    }

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码9 项目: jdk8u60   文件: BadClassFiles.java
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
源代码10 项目: openjdk-jdk8u-backup   文件: BadClassFiles.java
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
源代码11 项目: openjdk-8   文件: BadClassFiles.java
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
源代码12 项目: openjdk-jdk8u   文件: BadClassFiles.java
private BadClassFiles() throws ClassNotFoundException {
    classes = new Class<?>[] {
        loader.defineClass("EmptyName", EmptyName_bytes),
        loader.defineClass("BadModifiers", BadModifiers_bytes),
        loader.defineClass("BadNameIndex", BadNameIndex_bytes),
        loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
        loader.defineClass("ExtraParams", ExtraParams_bytes),
        // Name with .
        loader.defineClass("BadName1", BadName1_bytes),
        // Name with [
        loader.defineClass("BadName2", BadName2_bytes),
        // Name with ;
        loader.defineClass("BadName3", BadName3_bytes),
        // Name with /
        loader.defineClass("BadName4", BadName4_bytes)
    };
}
 
源代码13 项目: squirrelAI   文件: CreateSQLiteService.java
public static void main(String[] args) {
        try {

            Class.forName("org.sqlite.JDBC");
            connection = DriverManager.getConnection("jdbc:sqlite:SquirrelAI.db");
            statement = connection.createStatement();
//            String sql = "CREATE TABLE message(date varchar(255),name varchar(255),message varchar(512));";
            //UserName、NickName、RemarkName、Province、City
            String sql = "CREATE TABLE user(username varchar(255),nickname varchar(255),remarkname varchar(512),province varchar(512),city varchar(512));";

            statement.executeUpdate(sql);
            statement.close();
            connection.close();
            System.out.println("数据库创建成功!");

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
 
源代码14 项目: manifold   文件: GqlParentType.java
private void addInnerInterfaceType( InterfaceTypeDefinition type, SrcLinkedClass enclosingType )
{
  String identifier = makeIdentifier( type.getName(), false );
  String fqn = getFqn() + '.' + identifier;
  SrcLinkedClass srcClass = new SrcLinkedClass( fqn, enclosingType, Interface )
    .addInterface( IJsonBindingsBacked.class.getSimpleName() )
    .addAnnotation( new SrcAnnotationExpression( Structural.class.getSimpleName() )
      .addArgument( "factoryClass", Class.class, identifier + ".ProxyFactory.class" ) )
    .modifiers( Modifier.PUBLIC );
  addUnionInterfaces( type, srcClass );
  addActualNameAnnotation( srcClass, type.getName(), false );
  addSourcePositionAnnotation( srcClass, type, srcClass );
  addProxyFactory( srcClass );
  List<FieldDefinition> fieldDefinitions = type.getFieldDefinitions();
  for( FieldDefinition member: fieldDefinitions )
  {
    addMember( srcClass, member, name -> fieldDefinitions.stream().anyMatch( f -> f.getName().equals( name ) ) );
  }
  addInterfaceExtensions( type, srcClass );
  enclosingType.addInnerClass( srcClass );
}
 
源代码15 项目: openjdk-8   文件: DefaultValue.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getField(field1);
    Field f2 = klass.getField(field2);

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码16 项目: dragonwell8_jdk   文件: BadClassFiles.java
public void assertBadParameters(Class<?> cls) throws NoSuchMethodException {
    try {
        System.err.println("Trying " + cls);
        final Method method = cls.getMethod("m", int.class, int.class);
        final Parameter[] params = method.getParameters();
        System.err.println("Name " + params[0].getName());
        System.err.println("Did not see expected exception");
        errors++;
    } catch(MalformedParametersException e) {
        System.err.println("Expected exception seen");
    }
}
 
源代码17 项目: dragonwell8_jdk   文件: BadClassFiles.java
public void run() throws NoSuchMethodException {
    for (Class<?> cls : classes)
        assertBadParameters(cls);

    if (errors != 0)
        throw new RuntimeException(errors + " errors in test");
}
 
源代码18 项目: TencentKona-8   文件: DefaultValue.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getField(field1);
    Field f2 = klass.getField(field2);

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码19 项目: openjdk-8-source   文件: DefaultValue.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getField(field1);
    Field f2 = klass.getField(field2);

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码20 项目: TencentKona-8   文件: Inheritance1.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getField(field1);
    Field f2 = klass.getField(field2);

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码21 项目: manifold   文件: GqlParentType.java
private SrcType makeSrcType( SrcLinkedClass owner, Type type, boolean typeParam )
{
  SrcType srcType;
  if( type instanceof ListType )
  {
    srcType = new SrcType( "List" );
    srcType.addTypeParam( makeSrcType( owner, ((ListType)type).getType(), true ) );
  }
  else if( type instanceof TypeName )
  {
    String typeName = getJavaClassName( owner, (TypeName)type, typeParam );
    srcType = new SrcType( typeName );
    if( !typeParam )
    {
      Class<?> javaClass = getJavaClass( (TypeName)type, false );
      srcType.setPrimitive( javaClass != null && javaClass.isPrimitive() );
    }
  }
  else if( type instanceof NonNullType )
  {
    Type theType = ((NonNullType)type).getType();
    srcType = makeSrcType( owner, theType, typeParam );
    if( !typeParam && !srcType.isPrimitive() )
    {
      srcType.addAnnotation( new SrcAnnotationExpression( NotNull.class.getSimpleName() ) );
    }
  }
  else
  {
    throw new IllegalStateException( "Unhandled type: " + type.getClass().getTypeName() );
  }
  return srcType;
}
 
源代码22 项目: openjdk-8-source   文件: Inheritance1.java
public static boolean arePaddedPairwise(Class klass, String field1, String field2) throws Exception {
    Field f1 = klass.getField(field1);
    Field f2 = klass.getField(field2);

    int diff = offset(f1) - offset(f2);
    if (diff < 0) {
        // f1 is first
        return (offset(f2) - (offset(f1) + getSize(f1))) > 64;
    } else {
        // f2 is first
        return (offset(f1) - (offset(f2) + getSize(f2))) > 64;
    }
}
 
源代码23 项目: hottub   文件: Inheritance1.java
public static int getSize(Field field) {
    Class type = field.getType();
    if (type == byte.class)    { return 1; }
    if (type == boolean.class) { return 1; }
    if (type == short.class)   { return 2; }
    if (type == char.class)    { return 2; }
    if (type == int.class)     { return 4; }
    if (type == float.class)   { return 4; }
    if (type == long.class)    { return 8; }
    if (type == double.class)  { return 8; }
    return ADDRESS_SIZE;
}
 
源代码24 项目: TencentKona-8   文件: CaptureTest.java
public Tester makeAnon(final String message) {
    return new Tester(2) {
        protected String[] names() {
            return new String[] {
                "this$1",
                "param",
                "val$message"
            };
        }

        protected int[] modifiers() {
            return new int[] {
                Modifier.FINAL | MANDATED,
                Modifier.FINAL,
                Modifier.FINAL | SYNTHETIC
            };
        }

        protected Class[] types() {
            return new Class[] {
                Encloser.class,
                int.class,
                String.class
            };
        }

        public String message() {
            return message;
        }
    };
}
 
源代码25 项目: hottub   文件: CaptureTest.java
public Tester makeAnonExtendsInner(final String message) {
    return new InnerTester(2) {
        protected String[] names() {
            return new String[] {
                "this$1",
                "innerparam",
                "val$message"
            };
        }

        protected int[] modifiers() {
            return new int[] {
                Modifier.FINAL | MANDATED,
                Modifier.FINAL,
                Modifier.FINAL | SYNTHETIC
            };
        }

        protected Class[] types() {
            return new Class[] {
                Encloser.class,
                int.class,
                String.class
            };
        }

        public String message() {
            return message;
        }
    };
}
 
源代码26 项目: TencentKona-8   文件: BadClassFiles.java
public void assertBadParameters(Class<?> cls) throws NoSuchMethodException {
    try {
        System.err.println("Trying " + cls);
        final Method method = cls.getMethod("m", int.class, int.class);
        final Parameter[] params = method.getParameters();
        System.err.println("Name " + params[0].getName());
        System.err.println("Did not see expected exception");
        errors++;
    } catch(MalformedParametersException e) {
        System.err.println("Expected exception seen");
    }
}
 
源代码27 项目: native-obfuscator   文件: BadClassFiles.java
public void assertBadParameters(Class<?> cls) throws NoSuchMethodException {
    try {
        System.err.println("Trying " + cls);
        final Method method = cls.getMethod("m", int.class, int.class);
        final Parameter[] params = method.getParameters();
        System.err.println("Name " + params[0].getName());
        System.err.println("Did not see expected exception");
        errors++;
    } catch(MalformedParametersException e) {
        System.err.println("Expected exception seen");
    }
}
 
源代码28 项目: openjdk-8   文件: CaptureTest.java
public Tester makeAnonExtendsLocal(final String message) {
    abstract class LocalTester extends Tester {
        public LocalTester(final int localparam) {
            super(localparam);
        }

        protected String[] names() {
            return new String[] {
                "this$1",
                "localparam",
                "val$message"
            };
        }

        protected int[] modifiers() {
            return new int[] {
                Modifier.FINAL | MANDATED,
                Modifier.FINAL,
                Modifier.FINAL | SYNTHETIC
            };
        }

        protected Class[] types() {
            return new Class[] {
                Encloser.class,
                int.class,
                String.class
            };
        }

    }

    return new LocalTester(2) {
        public String message() {
            return message;
        }
    };
}
 
源代码29 项目: openjdk-jdk9   文件: CaptureTest.java
public Tester makeLocal(final String message) {
    class LocalTester extends Tester {
        public LocalTester(final int localparam) {
            super(localparam);
        }

        protected String[] names() {
            return new String[] {
                "this$1",
                "localparam",
                "val$message"
            };
        }

        protected int[] modifiers() {
            return new int[] {
                Modifier.FINAL | MANDATED,
                Modifier.FINAL,
                Modifier.FINAL | SYNTHETIC
            };
        }

        protected Class[] types() {
            return new Class[] {
                Encloser.class,
                int.class,
                String.class
            };
        }

        public String message() {
            return message;
        }
    }

    return new LocalTester(2);
}
 
源代码30 项目: openjdk-8   文件: MessageBase.java
static SystemException getSystemException(
    String exClassName, int minorCode, CompletionStatus completionStatus,
    String message, ORBUtilSystemException wrapper)
{
    SystemException sysEx = null;

    try {
        Class<?> clazz =
            SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
        if (message == null) {
            sysEx = (SystemException) clazz.newInstance();
        } else {
            Class[] types = { String.class };
            Constructor constructor = clazz.getConstructor(types);
            Object[] args = { message };
            sysEx = (SystemException)constructor.newInstance(args);
        }
    } catch (Exception someEx) {
        throw wrapper.badSystemExceptionInReply(
            CompletionStatus.COMPLETED_MAYBE, someEx );
    }

    sysEx.minor = minorCode;
    sysEx.completed = completionStatus;

    return sysEx;
}