Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Feb 26, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
*/
package org.androidannotations.helper;


import java.io.StringWriter;
import java.lang.reflect.Field;
import java.util.ArrayList;
Expand Down Expand Up @@ -81,7 +80,11 @@ public JClass typeMirrorToJClass(TypeMirror type, GeneratedClassHolder holder) {

TypeMirror extendsBound = wildcardType.getExtendsBound();

return typeMirrorToJClass(extendsBound, holder).wildcard();
if (extendsBound == null) {
return holder.classes().OBJECT.wildcard();
} else {
return typeMirrorToJClass(extendsBound, holder).wildcard();
}
} else if (type instanceof ArrayType) {
ArrayType arrayType = (ArrayType) type;

Expand Down Expand Up @@ -193,25 +196,25 @@ public JBlock removeBody(JMethod method) {
return clonedBody;
}

public void replaceSuperCall(JMethod method, JBlock replacement) {
String superCallStart = "super."+method.name()+"(";

JBlock oldBody = removeBody(method);
JBlock newBody = method.body();

for (Object content : oldBody.getContents()) {
StringWriter writer = new StringWriter();
JFormatter formatter = new JFormatter(writer);
JStatement statement = (JStatement) content;
statement.state(formatter);
String statementString = writer.getBuffer().toString();
if (statementString.startsWith(superCallStart)) {
newBody.add(replacement);
} else {
newBody.add(statement);
}
}
}
public void replaceSuperCall(JMethod method, JBlock replacement) {
String superCallStart = "super." + method.name() + "(";

JBlock oldBody = removeBody(method);
JBlock newBody = method.body();

for (Object content : oldBody.getContents()) {
StringWriter writer = new StringWriter();
JFormatter formatter = new JFormatter(writer);
JStatement statement = (JStatement) content;
statement.state(formatter);
String statementString = writer.getBuffer().toString();
if (statementString.startsWith(superCallStart)) {
newBody.add(replacement);
} else {
newBody.add(statement);
}
}
}

public String getIdStringFromIdFieldRef(JFieldRef idRef) {
try {
Expand Down Expand Up @@ -258,7 +261,7 @@ public JDefinedClass createDelegatingAnonymousRunnableClass(EComponentHolder hol
/**
* Gets all of the methods of the class and includes the methods of any
* implemented interfaces.
*
*
* @param typeElement
* @return full list of methods.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ public class Classes {
public final JClass THREAD = refClass(Thread.class);
public final JClass HASH_MAP = refClass(HashMap.class);
public final JClass LIST = refClass(List.class);
public final JClass OBJECT = refClass(Object.class);

/*
* Android
Expand Down Expand Up @@ -190,7 +191,7 @@ public class Classes {

public ProcessHolder(ProcessingEnvironment processingEnvironment) {
this.processingEnvironment = processingEnvironment;
this.codeModel = new JCodeModel();
codeModel = new JCodeModel();
classes = new Classes();
refClass(CanonicalNameConstants.STRING);
preloadJavaLangClasses();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

<ListView
android:id="@+id/listViewWithArgumentWithGenericWildcard"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>

<ListView
android:id="@+id/listViewWithPosition"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,17 @@ public void listView() {
public void listViewWithArgument(String selectedItem) {
listViewWithArgumentSelectedItem = selectedItem;
}

@ItemClick(R.id.listViewWithArgumentWithParameterType)
protected void listViewWithArgumentWithParameterType(ArrayList<String> item) {
listViewParametrizedItemClicked = true;
}

@ItemClick(R.id.listViewWithArgumentWithGenericWildcard)
protected void listViewWithArgumentWithGenericWildcardType(ArrayList<?> item) {
listViewParametrizedItemClicked = true;
}

@ItemClick
public void spinner() {
spinnerItemClicked = true;
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.