@Test(dataProvider = "array_or_declared_DP") public void appendType_type_from_current_package_without_import_uses_simple_reference(DAType type) throws Exception { FileContextTestImpl fileContext = fileContext("com.acme", false, false); CommonMethods commonMethods = new CommonMethodsImpl(fileContext, 0); commonMethods.appendType(type); assertThat(fileContext.getRes()).isEqualTo(type.isArray() ? "Name[]" : "Name"); }
@Override public void appendType(DAType type) throws IOException { append(useQualifiedReference(type) ? type.getQualifiedName() : type.getSimpleName()); if (type.getExtendsBound() != null) { append(" extends "); appendType(type.getExtendsBound()); } else if (type.getSuperBound() != null) { append(" super "); appendType(type.getExtendsBound()); } appendTypeArgs(type.getTypeArgs()); if (type.isArray()) { append("[]"); } }
CommonMethodsImpl implements CommonMethods { @Override public void appendType(DAType type) throws IOException { append(useQualifiedReference(type) ? type.getQualifiedName() : type.getSimpleName()); if (type.getExtendsBound() != null) { append(" extends "); appendType(type.getExtendsBound()); } else if (type.getSuperBound() != null) { append(" super "); appendType(type.getExtendsBound()); } appendTypeArgs(type.getTypeArgs()); if (type.isArray()) { append("[]"); } } }
CommonMethodsImpl implements CommonMethods { @Override public void appendType(DAType type) throws IOException { append(useQualifiedReference(type) ? type.getQualifiedName() : type.getSimpleName()); if (type.getExtendsBound() != null) { append(" extends "); appendType(type.getExtendsBound()); } else if (type.getSuperBound() != null) { append(" super "); appendType(type.getExtendsBound()); } appendTypeArgs(type.getTypeArgs()); if (type.isArray()) { append("[]"); } } CommonMethodsImpl(@Nonnull FileContext fileContext, int indentOffset); }
CommonMethodsImpl implements CommonMethods { @Override public void appendType(DAType type) throws IOException { append(useQualifiedReference(type) ? type.getQualifiedName() : type.getSimpleName()); if (type.getExtendsBound() != null) { append(" extends "); appendType(type.getExtendsBound()); } else if (type.getSuperBound() != null) { append(" super "); appendType(type.getExtendsBound()); } appendTypeArgs(type.getTypeArgs()); if (type.isArray()) { append("[]"); } } CommonMethodsImpl(@Nonnull FileContext fileContext, int indentOffset); @Override FileContext getFileContext(); @Override int getIndentOffset(); @Override void appendIndent(); @Override void appendModifiers(@Nullable DAModifier[] modifiers); @Override void appendAnnotations(Collection<DAAnnotation> annotations); @Override void appendInlineAnnotations(Collection<DAAnnotation> annotations); @Override void appendType(DAType type); @Override void appendTypeArgs(List<DAType> typeArgs); @Override void newLine(); @Override void flush(); @Override void close(); @Override Writer append(CharSequence csq); @Override Writer append(CharSequence csq, int start, int end); @Override Writer append(char c); }
CommonMethodsImpl implements CommonMethods { @Override public void appendType(DAType type) throws IOException { append(useQualifiedReference(type) ? type.getQualifiedName() : type.getSimpleName()); if (type.getExtendsBound() != null) { append(" extends "); appendType(type.getExtendsBound()); } else if (type.getSuperBound() != null) { append(" super "); appendType(type.getExtendsBound()); } appendTypeArgs(type.getTypeArgs()); if (type.isArray()) { append("[]"); } } CommonMethodsImpl(@Nonnull FileContext fileContext, int indentOffset); @Override FileContext getFileContext(); @Override int getIndentOffset(); @Override void appendIndent(); @Override void appendModifiers(@Nullable DAModifier[] modifiers); @Override void appendAnnotations(Collection<DAAnnotation> annotations); @Override void appendInlineAnnotations(Collection<DAAnnotation> annotations); @Override void appendType(DAType type); @Override void appendTypeArgs(List<DAType> typeArgs); @Override void newLine(); @Override void flush(); @Override void close(); @Override Writer append(CharSequence csq); @Override Writer append(CharSequence csq, int start, int end); @Override Writer append(char c);  }