Java Code Examples for com.sun.tools.javac.code.BoundKind#UNBOUND
The following examples show how to use
com.sun.tools.javac.code.BoundKind#UNBOUND .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TreeFactory.java From netbeans with Apache License 2.0 | 6 votes |
public WildcardTree Wildcard(Kind kind, Tree type) { final BoundKind boundKind; switch (kind) { case UNBOUNDED_WILDCARD: boundKind = BoundKind.UNBOUND; break; case EXTENDS_WILDCARD: boundKind = BoundKind.EXTENDS; break; case SUPER_WILDCARD: boundKind = BoundKind.SUPER; break; default: throw new IllegalArgumentException("Unknown wildcard bound " + kind); } TypeBoundKind tbk = make.at(NOPOS).TypeBoundKind(boundKind); return make.at(NOPOS).Wildcard(tbk, (JCExpression)type); }
Example 2
Source File: TestProcessor.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 3
Source File: TestProcessor.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 4
Source File: TestProcessor.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 5
Source File: TestProcessor.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 6
Source File: TestProcessor.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 7
Source File: TestProcessor.java From hottub with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 8
Source File: TestProcessor.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 9
Source File: TestProcessor.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
@Override public void visitWildcard(JCWildcard tree) { if (tree.kind.kind == BoundKind.UNBOUND) result = tree.kind.toString(); else result = tree.kind + " " + print(tree.inner); }
Example 10
Source File: ClassReader.java From lua-for-android with BSD 3-Clause "New" or "Revised" License | 4 votes |
public Type javaTypeToType(java.lang.reflect.Type type){ if(type instanceof Class) return classToType((Class) type); else if(type instanceof java.lang.reflect.WildcardType){ java.lang.reflect.Type[] lowerBounds=((java.lang.reflect.WildcardType) type).getLowerBounds(); java.lang.reflect.Type[] upperBounds=((java.lang.reflect.WildcardType) type).getUpperBounds(); if(lowerBounds.length>0){ if(upperBounds.length>1||lowerBounds.length!=1) {//always have object as its upper bound throw badClassFile("bad.class.file",type.toString()); } return new WildcardType(javaTypeToType(lowerBounds[0]),BoundKind.SUPER,syms.boundClass); }else if(upperBounds.length>0){ if(upperBounds.length!=1) { throw badClassFile("bad.class.file",type.toString()); } return new WildcardType(javaTypeToType(upperBounds[0]),BoundKind.EXTENDS,syms.boundClass); } return new WildcardType(syms.objectType,BoundKind.UNBOUND,syms.boundClass); }else if(type instanceof ParameterizedType){ java.lang.reflect.Type[] args=((ParameterizedType) type).getActualTypeArguments(); List<Type> params=StreamSupport.stream(Arrays.asList(args)).map(this::javaTypeToType).collect(List.collector()); ClassSymbol symbol=syms.enterClass(currentModule,names.fromString(((Class)((ParameterizedType) type).getRawType()).getName())); return new ClassType(Type.noType,params,symbol){ boolean completed; @Override public Type getEnclosingType() { if(!completed){ completed=true; tsym.complete(); super.setEnclosingType(tsym.type.getEnclosingType()); } return super.getEnclosingType(); } @Override public void setEnclosingType(Type outer) { throw new UnsupportedOperationException(); } }; }else if(type instanceof GenericArrayType){ return types.makeArrayType(javaTypeToType(((GenericArrayType) type).getGenericComponentType())); }else if(type instanceof TypeVariable) return findTypeVar(names.fromString(type.toString())); return null; }
Example 11
Source File: SrcClassUtil.java From manifold with Apache License 2.0 | 4 votes |
private String typeNoAnnotations( Type type ) { if( isJava8() ) { return type.toString(); } StringBuilder sb = new StringBuilder(); if( type instanceof Type.ClassType ) { if( type.getEnclosingType().hasTag( CLASS ) && ReflectUtil.field( type.tsym.owner, "kind" ).get() == ReflectUtil.field( "com.sun.tools.javac.code.Kinds$Kind", "TYP" ).getStatic() ) { sb.append( typeNoAnnotations( type.getEnclosingType() ) ); sb.append( "." ); sb.append( ReflectUtil.method( type, "className", Symbol.class, boolean.class ).invoke( type.tsym, false ) ); } else { sb.append( ReflectUtil.method( type, "className", Symbol.class, boolean.class ).invoke( type.tsym, true ) ); } List<Type> typeArgs = type.getTypeArguments(); if( typeArgs.nonEmpty() ) { sb.append( '<' ); for( int i = 0; i < typeArgs.size(); i++ ) { if( i > 0 ) { sb.append( ", " ); } Type typeArg = typeArgs.get( i ); sb.append( typeNoAnnotations( typeArg ) ); } sb.append( ">" ); } } else if( type instanceof Type.ArrayType ) { sb.append( typeNoAnnotations( ((Type.ArrayType)type).getComponentType() ) ).append( "[]" ); } else if( type instanceof Type.WildcardType ) { Type.WildcardType wildcardType = (Type.WildcardType)type; BoundKind kind = wildcardType.kind; sb.append( kind.toString() ); if( kind != BoundKind.UNBOUND ) { sb.append( typeNoAnnotations( wildcardType.type ) ); } } else { sb.append( type.toString() ); } return sb.toString(); }