-
Notifications
You must be signed in to change notification settings - Fork 13
Remove regex pattern from ParsingUtils #366
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
c586806
ab280cf
d879fba
213d038
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,8 @@ | |
| import java.util.Set; | ||
|
|
||
| import io.micrometer.common.docs.KeyName; | ||
| import io.micrometer.core.instrument.Meter; | ||
| import io.micrometer.core.instrument.docs.MeterDocumentation; | ||
| import io.micrometer.docs.RoasterTestUtils; | ||
| import org.jboss.forge.roaster.model.source.JavaClassSource; | ||
| import org.jboss.forge.roaster.model.source.MethodSource; | ||
|
|
@@ -49,6 +51,14 @@ void readMergeEnumClassName() { | |
| assertThat(result).containsExactlyInAnyOrder("FooKeyName", "BarKeyName", "BazKeyName"); | ||
| } | ||
|
|
||
| @Test | ||
| void readNestedEnumClassName() { | ||
| JavaClassSource javaSource = RoasterTestUtils.readJavaClass(ParsingUtilsReadEnumClassNamesTests.class); | ||
| MethodSource<?> methodSource = ((JavaClassSource) javaSource.getNestedType("MyClass")).getMethod("mergeNested"); | ||
| Set<String> result = ParsingUtils.readEnumClassNames(methodSource); | ||
| assertThat(result).containsExactlyInAnyOrder("NestedFooKeyName", "NestedBarKeyName"); | ||
|
||
| } | ||
|
|
||
| static class MyClass { | ||
|
|
||
| Enum<?>[] simple() { | ||
|
|
@@ -59,6 +69,11 @@ KeyName[] merge() { | |
| return KeyName.merge(FooKeyName.values(), BarKeyName.values(), BazKeyName.values()); | ||
| } | ||
|
|
||
| KeyName[] mergeNested() { | ||
| return KeyName.merge(FooMeterDocumentation.NestedFooKeyName.values(), | ||
| FooMeterDocumentation.NestedBarKeyName.values()); | ||
| } | ||
|
|
||
| } | ||
|
|
||
| enum FooKeyName implements KeyName { | ||
|
|
@@ -94,4 +109,42 @@ public String asString() { | |
|
|
||
| } | ||
|
|
||
| enum FooMeterDocumentation implements MeterDocumentation { | ||
|
|
||
| FOO { | ||
| @Override | ||
| public String getName() { | ||
| return "foo"; | ||
| } | ||
|
|
||
| @Override | ||
| public Meter.Type getType() { | ||
| return Meter.Type.COUNTER; | ||
| } | ||
| }; | ||
|
|
||
| enum NestedFooKeyName implements KeyName { | ||
|
|
||
| NESTED_FOO { | ||
| @Override | ||
| public String asString() { | ||
| return "nested.foo"; | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| enum NestedBarKeyName implements KeyName { | ||
|
|
||
| NESTED_BAR { | ||
| @Override | ||
| public String asString() { | ||
| return "nested.bar"; | ||
| } | ||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think anyone should have created an instance for this but strictly, this is a breaking change. I think we should fix this but maybe in another PR so we can call it out in the release notes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean who would ever want to instantiate this. I think that most IDEs suggest doing the private constructor. We can of course ignore this for the next minor and just not add this constructor.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is probably ok to break this in a minor version. I would just do it in a separate PR so it is easier to call out in the release notes and separate it from an enhancement PR.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree. This is resolved with commit: d879fba7.
Do you want me to open a PR for the private Constructor?