Skip to content

Commit

Permalink
Remove duplicate license headers (#568)
Browse files Browse the repository at this point in the history
* [1/x] Implement joda to java time migration recipe

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeFormatTemplates.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/DurationTemplates.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/DateTimeTemplates.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/MethodTemplate.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/TimeClassNames.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/main/java/org/openrewrite/java/migrate/joda/templates/TimeZoneTemplates.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/test/java/org/openrewrite/java/migrate/joda/JodaTimeVisitorTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/test/java/org/openrewrite/java/migrate/joda/JodaTimeVisitorTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update src/test/java/org/openrewrite/java/migrate/joda/JodaTimeVisitorTest.java

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* remove duplicate license header

* remove unused import

* duplicate import

---------

Co-authored-by: Sam Snyder <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Oct 4, 2024
1 parent 0ff9b62 commit f12381c
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 156 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.openrewrite.java.JavaVisitor;
import org.openrewrite.java.MethodMatcher;
import org.openrewrite.java.migrate.joda.templates.*;
import org.openrewrite.java.migrate.joda.templates.MethodTemplate;
import org.openrewrite.java.migrate.joda.templates.TimeZoneTemplates;
import org.openrewrite.java.tree.Expression;
import org.openrewrite.java.tree.J;
import org.openrewrite.java.tree.JavaType;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,3 @@
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* <p>
* https://www.apache.org/licenses/LICENSE-2.0
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* Copyright 2024 the original author or authors.
* <p>
Expand All @@ -51,7 +21,6 @@
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;


import static org.openrewrite.java.Assertions.java;
import static org.openrewrite.test.RewriteTest.toRecipe;

Expand All @@ -73,7 +42,7 @@ void migrateNewDateTime() {
import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(new DateTime());
Expand All @@ -95,7 +64,7 @@ public void foo() {
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(ZonedDateTime.now());
Expand Down Expand Up @@ -125,7 +94,7 @@ void migrateDateTimeStaticCalls() {
import org.joda.time.DateTimeZone;
import org.joda.time.format.DateTimeFormat;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(DateTime.now());
Expand All @@ -140,7 +109,7 @@ public void foo() {
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(ZonedDateTime.now());
Expand All @@ -164,7 +133,7 @@ void migrateDateTimeInstanceCalls() {
import org.joda.time.DateTimeZone;
import org.joda.time.Duration;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(new DateTime().toDateTime());
Expand Down Expand Up @@ -223,7 +192,7 @@ public void foo() {
import java.time.temporal.ChronoField;
import java.time.temporal.IsoFields;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(ZonedDateTime.now());
Expand Down Expand Up @@ -286,7 +255,7 @@ void migrateDateTimeZone() {
"""
import org.joda.time.DateTimeZone;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(DateTimeZone.UTC);
Expand All @@ -301,7 +270,7 @@ public void foo() {
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.TimeZone;
class A {
public void foo() {
System.out.println(ZoneOffset.UTC);
Expand All @@ -323,7 +292,7 @@ void migrateDateTimeFormatter() {
java(
"""
import org.joda.time.format.DateTimeFormat;
class A {
public void foo() {
System.out.println(DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
Expand All @@ -347,7 +316,7 @@ public void foo() {
"""
import java.time.format.DateTimeFormatter;
import java.time.format.FormatStyle;
class A {
public void foo() {
System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
Expand Down Expand Up @@ -379,7 +348,7 @@ void migrateJodaDuration() {
java(
"""
import org.joda.time.Duration;
class A {
public void foo() {
System.out.println(Duration.standardDays(1L));
Expand Down Expand Up @@ -411,7 +380,7 @@ public void foo() {
"""
import java.time.Duration;
import java.time.Instant;
class A {
public void foo() {
System.out.println(Duration.ofDays(1L));
Expand Down Expand Up @@ -458,7 +427,7 @@ public void foo() {
""",
"""
import java.time.format.DateTimeFormatter;
class A {
public void foo() {
System.out.println(DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ"));
Expand All @@ -476,7 +445,7 @@ void migrateJodaTypeExpressionReferencingNonJodaTypeVar() {
java(
"""
import org.joda.time.DateTime;
class A {
public void foo() {
long millis = DateTime.now().getMillis();
Expand Down Expand Up @@ -506,7 +475,7 @@ void dontChangeMethodAccessOnVariable() {
java(
"""
import org.joda.time.DateTime;
class A {
public void foo() {
DateTime dt = new DateTime();
Expand All @@ -529,13 +498,13 @@ void dontChangeIncompatibleType() {
java(
"""
import org.joda.time.DateTime;
class A {
public void foo() {
new B().print(new DateTime()); // print is public method accepting DateTime, not handled yet
}
}
class B {
public void print(DateTime dateTime) {
System.out.println(dateTime);
Expand All @@ -554,7 +523,7 @@ void dontChangeMethodsWithUnhandledArguments() {
"""
import org.joda.time.DateTime;
import org.joda.time.format.DateTimeFormat;
class A {
public void foo() {
// DateTimeFormat.forStyle is unhandled so parent method should not be changed
Expand Down

0 comments on commit f12381c

Please sign in to comment.