Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

MethodSpec factory for overriding an ExecutableElement. #229

Merged
merged 1 commit into from
Feb 19, 2015

Conversation

JakeWharton
Copy link
Collaborator

Anyone know a good way to test this without writing a novel of mocking? I filed google/compile-testing#65 which seems like it would be a good approach.

Closes #228.

@JakeWharton
Copy link
Collaborator Author

Also, two questions:

  • Do we copy method annotations?
  • Do we copy param annotations?

Copying type annotations seems like an obvious yes but we don't support that yet (#136).

@swankjesse
Copy link
Collaborator

Make sure you don't get two @Override annotations if one is already present.

On copying over annotations, we should do what IntelliJ does: copy 'em. Though we need API to remove annotations too.

On testing, can you do what TypesTest does to get Elements for the current file?

@JakeWharton
Copy link
Collaborator Author

PTAL.

Copying annotations requires non-trivial infrastructure around being able to create AnnotationSpec's from AnnotationMirrors which I'll do in a follow-up.

@@ -150,6 +156,52 @@ public static Builder constructorBuilder() {
return new Builder(CONSTRUCTOR);
}

/**
* Create a builder which overrides the specified {@code method}. This will copy its visibility
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: drop the specified. Using code font is good enough!

@swankjesse
Copy link
Collaborator

LGTM

JakeWharton added a commit that referenced this pull request Feb 19, 2015
MethodSpec factory for overriding an ExecutableElement.
@JakeWharton JakeWharton merged commit 395a2bc into master Feb 19, 2015
@JakeWharton JakeWharton deleted the jw/override branch February 19, 2015 00:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Factory for MethodSpec.Builder for overriding ExecutableElement
2 participants