@Override protected IMirror createMirrorForFQN(String name) { try { Class<?> clazz = classFinder.forName(name); return createMirror(clazz); } catch (ClassNotFoundException e) { return null; } }
@Override protected IMirror createMirrorForFQN(String name) { try { Class<?> clazz = classFinder.forName(name); return createMirror(clazz); } catch (ClassNotFoundException e) { return null; } }
protected Class<?> getJavaType(JvmType type) throws ClassNotFoundException { return classFinder.forName(type.getQualifiedName()); }
private Class<?> findClassByName(String name) throws ClassNotFoundException { try { Class<?> clazz = classFinder.forName(name); return clazz; } catch(ClassNotFoundException exception) { int index = name.lastIndexOf('.'); if (index <= 0) { throw exception; } String baseName = name.substring(0, index); try { Class<?> resolvedOuterClass = findClassByName(baseName); baseName = resolvedOuterClass.getName(); } catch (ClassNotFoundException baseNameException) { throw exception; } Class<?> clazz = classFinder.forName(baseName + '$' + name.substring(index + 1)); return clazz; } }
private Class<?> findClassByName(String name) throws ClassNotFoundException { try { Class<?> clazz = classFinder.forName(name); return clazz; } catch(ClassNotFoundException exception) { int index = name.lastIndexOf('.'); if (index <= 0) { throw exception; } String baseName = name.substring(0, index); try { Class<?> resolvedOuterClass = findClassByName(baseName); baseName = resolvedOuterClass.getName(); } catch (ClassNotFoundException baseNameException) { throw exception; } final String validBaseName = baseName; try { String binaryName = baseName + '$' + name.substring(index + 1); Class<?> clazz = classFinder.forName(binaryName); return clazz; } catch(ClassNotFoundException e) { throw new ClassNotFoundExceptionWithBaseName(validBaseName); } } }
protected Object translateJvmTypeToResult(JvmType type, int arrayDims) { try { String arrayDimensions = ""; for (int i=0;i<arrayDims;i++) arrayDimensions+="[]"; return classFinder.forName(type.getQualifiedName()+arrayDimensions); } catch (ClassNotFoundException e) { throw new EvaluationException(e); } }
protected Class<?> getJavaType(final JvmType type, final ClassFinder classFinder) throws ClassNotFoundException { if ((type instanceof JvmArrayType)) { JvmType t = type; String dimensions = ""; while ((t instanceof JvmArrayType)) { { dimensions = (dimensions + "[]"); t = ((JvmArrayType)t).getComponentType(); } } final Class<?> componentClass = this.getJavaType(t, classFinder); String _name = componentClass.getName(); String _plus = (_name + dimensions); return classFinder.forName(_plus); } String _identifier = type.getIdentifier(); boolean _equals = Objects.equal(_identifier, "java.lang.Class"); if (_equals) { return JvmTypeReference.class; } if ((type instanceof JvmEnumerationType)) { return JvmEnumerationLiteral.class; } if ((type instanceof JvmAnnotationType)) { return XAnnotation.class; } return classFinder.forName(type.getIdentifier()); }
protected boolean isInstanceoOf(Object value, JvmTypeReference type) { if (type instanceof JvmSynonymTypeReference) { for(JvmTypeReference synonym: ((JvmSynonymTypeReference) type).getReferences()) { if (isInstanceoOf(value, synonym)) { return true; } } return false; } String exceptionTypeName = type.getType().getQualifiedName(); try { Class<?> exceptionType = classFinder.forName(exceptionTypeName); if (exceptionType.isInstance(value)) return true; } catch (ClassNotFoundException e) { throw new EvaluationException(new NoClassDefFoundError(exceptionTypeName)); } return false; }
@Override public JvmType findTypeByName(String name) { try { // seems to be the only reliable way to locate nested types // since dollar signs are a quite good indicator but not necessarily the best Class<?> clazz = classFinder.forName(name); return findTypeByClass(clazz); } catch (ClassNotFoundException e) { return tryFindTypeInIndex(name, true); } catch (NoClassDefFoundError e) { /* * Error will be thrown if the contents of the binary class file does not match the expectation (transitively). * See java.lang.ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) */ return tryFindTypeInIndex(name, true); } }
@Override public JvmType findTypeByName(String name) { try { // seems to be the only reliable way to locate nested types // since dollar signs are a quite good indicator but not necessarily the best Class<?> clazz = classFinder.forName(name); return findTypeByClass(clazz); } catch (UnknownNestedTypeException e) { return null; } catch (ClassNotFoundException e) { return tryFindTypeInIndex(name, true); } catch (NoClassDefFoundError e) { /* * Error will be thrown if the contents of the binary class file does not match the expectation (transitively). * See java.lang.ClassLoader.defineClass(String, byte[], int, int, ProtectionDomain) */ return tryFindTypeInIndex(name, true); } }
Class<?> componentClass = getRawType(componentType); try { return getClassFinder().forName(componentClass.getName() + "[]"); } catch (ClassNotFoundException e) { if (log.isDebugEnabled()) return getClassFinder().forName(type.getIdentifier()); } catch (ClassNotFoundException e) { if (log.isDebugEnabled())
Class<?> componentClass = getRawType(componentType); try { return getClassFinder().forName(componentClass.getName() + "[]"); } catch (ClassNotFoundException e) { if (log.isDebugEnabled()) return getClassFinder().forName(type.getIdentifier()); } catch (ClassNotFoundException e) { if (log.isDebugEnabled())
try { JvmType type = expectedType.getType(); Class<?> functionIntf = classFinder.forName(type.getIdentifier()); if (!functionIntf.isInstance(value)) { InvocationHandler invocationHandler = null;