Skip to content

Commit 53c6b3e

Browse files
1 parent 0437c5c commit 53c6b3e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/main/resources/META-INF/rewrite/examples.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,6 +1987,37 @@ examples:
19871987
language: java
19881988
---
19891989
type: specs.openrewrite.org/v1beta/example
1990+
recipeName: org.openrewrite.staticanalysis.PreferSystemGetPropertyOverGetenv
1991+
examples:
1992+
- description: ''
1993+
sources:
1994+
- before: |
1995+
class A {
1996+
void test() {
1997+
String user = System.getenv("USER");
1998+
String username = System.getenv("USERNAME");
1999+
String home = System.getenv("HOME");
2000+
String profile = System.getenv("USERPROFILE");
2001+
String temp = System.getenv("TEMP");
2002+
String tmpdir = System.getenv("TMPDIR");
2003+
String tmp = System.getenv("TMP");
2004+
}
2005+
}
2006+
after: |
2007+
class A {
2008+
void test() {
2009+
String user = System.getProperty("user.name");
2010+
String username = System.getProperty("user.name");
2011+
String home = System.getProperty("user.home");
2012+
String profile = System.getProperty("user.home");
2013+
String temp = System.getProperty("java.io.tmpdir");
2014+
String tmpdir = System.getProperty("java.io.tmpdir");
2015+
String tmp = System.getProperty("java.io.tmpdir");
2016+
}
2017+
}
2018+
language: java
2019+
---
2020+
type: specs.openrewrite.org/v1beta/example
19902021
recipeName: org.openrewrite.staticanalysis.PrimitiveWrapperClassConstructorToValueOf
19912022
examples:
19922023
- description: ''

0 commit comments

Comments
 (0)