Examples of TypeName


Examples of com.google.java.contract.core.model.TypeName

    MethodModel contracted = null;
    if (kind.isMethodContract()) {
      contracted = (MethodModel) annotation.getEnclosingElement();
    }

    TypeName returnType = new TypeName("void");
    String name = getHelperName(kind, annotation.getOwner(), contracted);
    if (nameSuffix != null) {
      name += nameSuffix;
    }
    if (annotation.isPrimary()) {
View Full Code Here

Examples of com.google.java.contract.core.model.TypeName

  static MethodModel createContractHelper(ContractCreationTrait trait,
                                          ContractAnnotationModel annotation) {
    ContractKind kind = getContractKind(annotation);
    MethodModel method = createBlankContractHelper(kind, annotation, null);

    TypeName returnType =
        new TypeName(kind.getVariance() == ContractVariance.CONTRAVARIANT
                     ? trait.getExceptionName()
                     : "void");
    method.setReturnType(returnType);

    if (kind.getVariance() == ContractVariance.CONTRAVARIANT) {
View Full Code Here

Examples of com.google.java.contract.core.model.TypeName

  TypeName getTypeNameForType(TypeMirror type) {
    switch (type.getKind()) {
      case NONE:
        return null;
      default:
        return new TypeName(type.toString());
    }
  }
View Full Code Here

Examples of com.google.java.contract.core.model.TypeName

    String name = element.getSimpleName().toString();
    List<? extends TypeMirror> bounds = element.getBounds();
    if (bounds.isEmpty()
        || (bounds.size() == 1
            && bounds.get(0).toString().equals("java.lang.Object"))) {
      return new TypeName(name);
    }

    StringBuilder buffer = new StringBuilder();
    buffer.append(name);
    buffer.append(" extends ");

    Iterator<? extends TypeMirror> iter = bounds.iterator();
    for (;;) {
      buffer.append(iter.next().toString());
      if (!iter.hasNext()) {
        break;
      }
      buffer.append(" & ");
    }

    return new TypeName(buffer.toString());
  }
View Full Code Here

Examples of com.sun.jdo.spi.persistence.support.sqlstore.query.util.scope.TypeName

    }
   
    // get base name
    int index = className.lastIndexOf('.');
    String identName = index>0 ? className.substring(index+1) : className;
    typeNames.declare(identName, new TypeName(candidateClass, className));
   
    // init symbol table with field names of the candidate class
    FieldInfo[] fieldInfos = candidateClass.getFieldInfos();
    for (int i = 0; i < fieldInfos.length; i++)
    {
View Full Code Here

Examples of com.sun.jdo.spi.persistence.support.sqlstore.query.util.scope.TypeName

   
    // get base name
    int index = name.lastIndexOf('.');
    String identName = index>0 ? name.substring(index+1) : name;
   
    Definition old = typeNames.declare(identName, new TypeName(type, name));
    if (old != null)
    {
    errorMsg.error(i_AST.getLine(), i_AST.getColumn(),
    I18NHelper.getMessage(messages, "jqlc.semantic.generic.alreadydeclared", //NOI18N
    identName, old.getName()));
View Full Code Here

Examples of org.allspice.bytecode.TypeName

public class TestField extends MyTestCase {
  public ClassDef defadd(String type) {
    ClassDef cd = makeClass() ;
   
    FieldDef fd = new FieldDef(Scope.PUBLIC,new TypeName(type),"foo") ;
    cd = cd.addField(fd) ;
    {
      Var x = new Var(1,new TypeName(type)) ;
      MethodDef md = new MethodDef(TypeName.VOID,"setFoo",x) ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new Load(x),
          new Store(new FieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.VOID)
          ) ;
      cd = cd.addMethod(md) ;
    }
    {
      MethodDef md = new MethodDef(new TypeName(type),"getFoo") ;
      md = md.addInstructions(
          new Load(new Var(0,new TypeName("TestClass"))),
          new Load(new FieldRef(cd.name,new TypeName(type),"foo")),
          new Return(TypeCode.getType(type))
          ) ;
      cd = cd.addMethod(md) ;
    }
    return cd ;
View Full Code Here

Examples of org.allspice.bytecode.TypeName

import org.allspice.bytecode.instructions.Return;

public class TestCompare extends MyTestCase {
  public ClassDef defadd(String type,int i1) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,new TypeName(type)) ;
    Var y = new Var(i1,new TypeName(type)) ;
    MethodDef md = new MethodDef(TypeName.INT,"meth",x,y) ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new Compare(TypeCode.getType(type)),
View Full Code Here

Examples of org.allspice.bytecode.TypeName

import org.allspice.bytecode.instructions.Return;

public class TestArrIncrement extends MyTestCase {
  public ClassDef defadd(Number inc) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(1,new TypeName("int[]")) ;
    MethodDef md = new MethodDef(TypeName.VOID,"meth",x) ;
    md = md.addInstructions(
        new Load(x),
        new Const(0),
        new Increment(new ArrLValue(TypeName.INT),inc),
View Full Code Here

Examples of org.allspice.bytecode.TypeName

import org.allspice.bytecode.instructions.Return;

public class TestDiv extends MyTestCase {
  public ClassDef defadd(String ret,String type,int i1,int i2) {
    ClassDef cd = makeClassDef() ;
    Var x = new Var(i1,new TypeName(type)) ;
    Var y = new Var(i2,new TypeName(type)) ;
    MethodDef md = new MethodDef(new TypeName(ret),"meth",x,y) ;
    md = md.addInstructions(
        new Load(x),
        new Load(y),
        new Divide(TypeCode.getType(type)),
        new Return(TypeCode.getType(ret))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.