-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3479 from Rawi01/extensionmethod-record
Add support for extension methods on records
- Loading branch information
Showing
5 changed files
with
60 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
test/transform/resource/after-delombok/ExtensionMethodOnRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// version 14: | ||
public record ExtensionMethodOnRecord() { | ||
public void test() { | ||
ExtensionMethodOnRecord.Extensions.intValue("1"); | ||
} | ||
|
||
static class Extensions { | ||
public static Integer intValue(String s) { | ||
return Integer.valueOf(s); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
test/transform/resource/after-ecj/ExtensionMethodOnRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// version 14: | ||
import lombok.experimental.ExtensionMethod; | ||
public @ExtensionMethod(ExtensionMethodOnRecord.Extensions.class) record ExtensionMethodOnRecord() { | ||
static class Extensions { | ||
Extensions() { | ||
super(); | ||
} | ||
public static Integer intValue(String s) { | ||
return Integer.valueOf(s); | ||
} | ||
} | ||
public ExtensionMethodOnRecord() { | ||
super(); | ||
} | ||
public void test() { | ||
ExtensionMethodOnRecord.Extensions.intValue("1"); | ||
} | ||
} |
16 changes: 16 additions & 0 deletions
16
test/transform/resource/before/ExtensionMethodOnRecord.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// version 14: | ||
import lombok.experimental.ExtensionMethod; | ||
|
||
@ExtensionMethod(ExtensionMethodOnRecord.Extensions.class) | ||
public record ExtensionMethodOnRecord() { | ||
|
||
public void test() { | ||
"1".intValue(); | ||
} | ||
|
||
static class Extensions { | ||
public static Integer intValue(String s) { | ||
return Integer.valueOf(s); | ||
} | ||
} | ||
} |