private IConstructorInfo getSingleConsructor( IType typeToResolveAgainst, ITypeInfo typeInfo ) { List<? extends IConstructorInfo> constructors; if( typeInfo instanceof IRelativeTypeInfo ) { constructors = ((IRelativeTypeInfo)typeInfo).getConstructors( typeToResolveAgainst ); } else { constructors = typeInfo.getConstructors(); } return constructors.size() == 1 ? constructors.get( 0 ) : null; }
@Override public List<? extends IConstructorInfo> getConstructors() { return _superType.getTypeInfo().getConstructors(); }
protected IConstructorHandler init() { return ASYNC_RESPONSE_IMPL_TYPE.get().getTypeInfo().getConstructors().get( 0 ).getConstructor(); } };
private static IConstructorInfo findCallableConstructor( IType type, IType[] runtimeTypes ) { ITypeInfo typeInfo = type.getTypeInfo(); List<? extends IConstructorInfo> constructors = typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getConstructors( type ) : typeInfo.getConstructors(); return ITypeInfo.FIND.callableConstructor( constructors, runtimeTypes ); }
private static IConstructorInfo findCallableConstructor( IType type, IType[] runtimeTypes ) { ITypeInfo typeInfo = type.getTypeInfo(); List<? extends IConstructorInfo> constructors = typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getConstructors( type ) : typeInfo.getConstructors(); return ITypeInfo.FIND.callableConstructor( constructors, runtimeTypes ); }
String text = _editor.getText(); int insertionPoint = text.indexOf( "\n", text.indexOf( "{", _sourceOfIssue.getLocation().getOffset() ) ) + 1; List<? extends IConstructorInfo> constructors = supertype.getTypeInfo().getConstructors(); try
private List<? extends IInvocableType> getConstructorTypes() { ArrayList<IInvocableType> constructorTypes = new ArrayList<>(); IType rootType = getRootTypeToResolveFeaturesAgainst(); ITypeInfo typeInfo = rootType.getTypeInfo(); List<? extends IConstructorInfo> constructors; if( typeInfo instanceof IRelativeTypeInfo ) { constructors = ((IRelativeTypeInfo)typeInfo).getConstructors( rootType ); } else { constructors = typeInfo.getConstructors(); } for( IConstructorInfo ci : constructors ) { constructorTypes.add( new ConstructorType( ci ) ); } return constructorTypes; }
String text = _editor.getText(); int insertionPoint = text.indexOf( "\n", text.indexOf( "{", _sourceOfIssue.getLocation().getOffset() ) ) + 1; List<? extends IConstructorInfo> constructors = supertype.getTypeInfo().getConstructors(); try
private IAnnotationInfo makeAutocreateAnnotation(Function0 function) { final IType autocreateType = TypeSystem.getByFullName("gw.lang.Autocreate"); List<? extends IConstructorInfo> constructors = autocreateType.getTypeInfo().getConstructors(); for (IConstructorInfo constructor : constructors) { if (constructor.getParameters().length == 1) { final Object val = constructor.getConstructor().newInstance(function); return new AutoCreateAnnotationInfo(autocreateType, val); } } throw new IllegalStateException("Could not find the block constructor for Autocreate"); }
private IConstructorInfo getConstructor( IType instanceClass ) { IConstructorInfo firstCtor = null; if( instanceClass.getTypeInfo() instanceof IRelativeTypeInfo) { if( !instanceClass.isInterface() ) { List<? extends IConstructorInfo> ctors = ( (IRelativeTypeInfo) instanceClass.getTypeInfo() ).getConstructors( instanceClass ); if ( ! ctors.isEmpty() ) { firstCtor = ctors.get( 0 ); } } } else { if( !instanceClass.isInterface() ) { ITypeInfo typeInfo = instanceClass.getTypeInfo(); if (typeInfo == null) { firstCtor = null; } else { List<? extends IConstructorInfo> ctors = typeInfo.getConstructors(); if ( ! ctors.isEmpty() ) { firstCtor = ctors.get( 0 ); } } } } return firstCtor; }
private IConstructorInfo getConstructor( IType instanceClass ) { IConstructorInfo firstCtor = null; if( instanceClass.getTypeInfo() instanceof IRelativeTypeInfo) { if( !instanceClass.isInterface() ) { List<? extends IConstructorInfo> ctors = ( (IRelativeTypeInfo) instanceClass.getTypeInfo() ).getConstructors( instanceClass ); if ( ! ctors.isEmpty() ) { firstCtor = ctors.get( 0 ); } } } else { if( !instanceClass.isInterface() ) { ITypeInfo typeInfo = instanceClass.getTypeInfo(); if (typeInfo == null) { firstCtor = null; } else { List<? extends IConstructorInfo> ctors = typeInfo.getConstructors(); if ( ! ctors.isEmpty() ) { firstCtor = ctors.get( 0 ); } } } } return firstCtor; }
List<? extends IConstructorInfo> constructors = typeInfo.getConstructors(); if( constructors != null && constructors.size() == 1 )
constructors = ((IRelativeTypeInfo) typeInfo).getConstructors(rootType); } else { constructors = typeInfo.getConstructors();
private void generateSuperCall() List<? extends IConstructorInfo> constructors = supertype.getTypeInfo().getConstructors(); if( constructors.size() == 1 )
private void verifyConstructorIsAccessible( IType instanceClass, NewExpression e, IConstructorType constructorType, boolean bAnonymous ) { if( e.getType() instanceof ErrorType ) { return; } if( constructorType != null ) { ITypeInfo typeInfo = instanceClass.getTypeInfo(); List<? extends IConstructorInfo> accessibleCtors = getGosuClass() != null && typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getConstructors( getGosuClass() ) : typeInfo.getConstructors(); //noinspection SuspiciousMethodCalls verify( e, accessibleCtors.contains( constructorType.getConstructor() ) || (bAnonymous && constructorType.getConstructor().isProtected()), Res.MSG_CTOR_HAS_XXX_ACCESS, getModifierString( constructorType ) ); } }
ctors = ((IRelativeTypeInfo)typeInfo).getConstructors( declaringType ); } else { ctors = typeInfo.getConstructors();
private void verifyConstructorIsAccessible( IType instanceClass, NewExpression e, IConstructorType constructorType, boolean bAnonymous ) { if( e.getType() instanceof ErrorType ) { return; } if( constructorType != null && !(constructorType.getConstructor() instanceof DynamicConstructorInfo) ) { ITypeInfo typeInfo = instanceClass.getTypeInfo(); List<? extends IConstructorInfo> accessibleCtors = getGosuClass() != null && typeInfo instanceof IRelativeTypeInfo ? ((IRelativeTypeInfo)typeInfo).getConstructors( getGosuClass() ) : typeInfo.getConstructors(); //noinspection SuspiciousMethodCalls verify( e, accessibleCtors.contains( constructorType.getConstructor() ) || (bAnonymous && constructorType.getConstructor().isProtected()), Res.MSG_CTOR_HAS_XXX_ACCESS, getModifierString( constructorType ) ); } }
ctors = ((IRelativeTypeInfo)typeInfo).getConstructors( declaringType ); } else { ctors = typeInfo.getConstructors();
private TestEnvironment createTestEnvironment(String[] pathComponents) { // TODO - AHK - Error handling // TODO - AHK - Validate that it's actually a TestEnvironment // TODO - AHK - Handle the case where there's no appropriate constructor String typeName = constructTypeName(pathComponents, 0, pathComponents.length - 2); String[] constructorArgs = splitArgs(pathComponents[pathComponents.length - 2]); IType testEnvironmentType = TypeSystem.getByFullName(typeName); TestEnvironment testEnvironment = null; for (IConstructorInfo cons : testEnvironmentType.getTypeInfo().getConstructors()) { if (cons.getParameters().length == constructorArgs.length) { Object[] convertedArgs = convertConstructorArgs(constructorArgs, cons.getParameters()); testEnvironment = (TestEnvironment) cons.getConstructor().newInstance(convertedArgs); break; } } return testEnvironment; }
@Override public Object getInstance() { ITypeInfo autocreateTypeInfo = GosuTypes.AUTOCREATE().getTypeInfo(); if ( _concreteType != null && JavaTypes.LIST().isAssignableFrom( _concreteType ) ) { for ( IConstructorInfo constructor : autocreateTypeInfo.getConstructors()) { IParameterInfo[] constructorParams = constructor.getParameters(); if (constructorParams.length > 0 && constructorParams[0].getFeatureType() instanceof IBlockType ) { try { IGosuParser parser = GosuParserFactory.createParser( "\\ -> new java.util.ArrayList()" ); IExpression expr = parser.parseExp( new TypelessScriptPartId( "Xml Schema autocreate block" ) ); Object block = expr.evaluate(); return constructor.getConstructor().newInstance(block); } catch (Exception e) { throw new RuntimeException(e); } } } } return autocreateTypeInfo.getConstructor().getConstructor().newInstance(); }