Skip to content

Commit

Permalink
refined functionality for any attribute, which inialized comes from
Browse files Browse the repository at this point in the history
default interface method. #67
  • Loading branch information
elucash committed Dec 31, 2014
1 parent 798a7a7 commit ff3b5bd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
Expand Up @@ -19,6 +19,7 @@
import java.lang.annotation.RetentionPolicy;
import org.immutables.value.Value;

@Value.Immutable
@interface NoDefault {
int value();

Expand Down
Expand Up @@ -27,13 +27,13 @@
import org.immutables.value.Value;
import org.immutables.value.processor.meta.Proto.Protoclass;
import org.immutables.value.processor.meta.Styles.UsingName.AttributeNames;

import javax.annotation.Nullable;
import javax.lang.model.element.*;
import javax.lang.model.type.ArrayType;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeKind;
import javax.lang.model.type.TypeMirror;
import javax.lang.model.util.ElementFilter;
import java.util.*;

/**
Expand Down Expand Up @@ -359,18 +359,15 @@ public boolean isGenerateEnumSet() {
private CharSequence defaultInterface;

public CharSequence defaultInterface() {
if (!isGenerateDefault) {
return "";
}
if (defaultInterface == null) {
defaultInterface = inferDefaultInterface();
}
return defaultInterface;
}

private CharSequence inferDefaultInterface() {
Element enclosing = element.getEnclosingElement();
if (enclosing.getKind() == ElementKind.INTERFACE) {
if (element.getEnclosingElement().getKind() == ElementKind.INTERFACE
&& !element.getModifiers().contains(Modifier.ABSTRACT)) {
if (containingType.element.getKind() == ElementKind.INTERFACE) {
return containingType.typeAbstract().relative();
}
Expand Down

0 comments on commit ff3b5bd

Please sign in to comment.