Skip to content

Commit

Permalink
renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
LangChain4j committed Oct 28, 2024
1 parent 46c0693 commit ed25a8e
Show file tree
Hide file tree
Showing 26 changed files with 34 additions and 34 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ available in the OpenRewrite docs that provides more details than the below READ
## Reference recipes

* [META-INF/rewrite/stringutils.yml](./src/main/resources/META-INF/rewrite/stringutils.yml) - A declarative YAML recipe that replaces usages of `org.springframework.util.StringUtils` with `org.apache.commons.lang3.StringUtils`.
* [UseApacheStringUtilsTest](./src/test/java/com/yourorg/UseApacheStringUtilsTest.java) - A test class for the `com.yourorg.UseApacheStringUtils` recipe.
* [UseApacheStringUtilsTest](./src/test/java/com/yourorg/UseApacheStringUtilsTest.java) - A test class for the `dev.langchain4j.UseApacheStringUtils` recipe.
* [NoGuavaListsNewArrayList.java](./src/main/java/com/yourorg/NoGuavaListsNewArrayList.java) - An imperative Java recipe that replaces usages of `com.google.common.collect.Lists` with `new ArrayList<>()`.
* [NoGuavaListsNewArrayListTest.java](./src/test/java/com/yourorg/NoGuavaListsNewArrayListTest.java) - A test class for the `NoGuavaListsNewArrayList` recipe.
* [SimplifyTernary](./src/main/java/com/yourorg/SimplifyTernary.java) - An Refaster style recipe that simplifies ternary expressions.
Expand Down Expand Up @@ -69,12 +69,12 @@ In the pom.xml of a different project you wish to test your recipe out in, make
<version>RELEASE</version>
<configuration>
<activeRecipes>
<recipe>com.yourorg.NoGuavaListsNewArrayList</recipe>
<recipe>dev.langchain4j.NoGuavaListsNewArrayList</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>com.yourorg</groupId>
<groupId>dev.langchain4j</groupId>
<artifactId>rewrite-recipe-starter</artifactId>
<version>0.1.0-SNAPSHOT</version>
</dependency>
Expand All @@ -100,11 +100,11 @@ repositories {
}
dependencies {
rewrite("com.yourorg:rewrite-recipe-starter:latest.integration")
rewrite("dev.langchain4j:rewrite-recipe-starter:latest.integration")
}
rewrite {
activeRecipe("com.yourorg.NoGuavaListsNewArrayList")
activeRecipe("dev.langchain4j.NoGuavaListsNewArrayList")
}
```

Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ plugins {
}

// Set as appropriate for your organization
group = "com.yourorg"
group = "dev.langchain4j"
description = "Rewrite recipes."

dependencies {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://maven.apache.org/POM/4.0.0"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.yourorg</groupId>
<groupId>dev.langchain4j</groupId>
<artifactId>rewrite-recipe-starter</artifactId>
<version>1.0.1-SNAPSHOT</version>

Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "rewrite-recipe-starter"
rootProject.name = "langchain4j-openrewrite-recipes"
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import lombok.EqualsAndHashCode;
import lombok.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import lombok.EqualsAndHashCode;
import lombok.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import com.yourorg.table.ClassHierarchyReport;
import dev.langchain4j.table.ClassHierarchyReport;
import lombok.EqualsAndHashCode;
import lombok.Value;
import org.openrewrite.ExecutionContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import fj.data.Option;
import lombok.EqualsAndHashCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import lombok.EqualsAndHashCode;
import lombok.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import com.google.errorprone.refaster.annotation.AfterTemplate;
import com.google.errorprone.refaster.annotation.BeforeTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

// TODO - This is a placeholder for a Refaster recipe. Implement the recipe by adding before and after annotated methods.
// The rule should replace calls to `String.length() == 0` with `String.isEmpty()`, as well as similar variants.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import lombok.EqualsAndHashCode;
import lombok.Value;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@
*/
@NullMarked
@NonNullFields
package com.yourorg;
package dev.langchain4j;
import org.jspecify.annotations.NullMarked;
import org.openrewrite.internal.lang.NonNullFields;
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg.table;
package dev.langchain4j.table;

import lombok.Value;
import org.openrewrite.Column;
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/rewrite/rewrite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
# You can also have multiple files in `src/main/resources/META-INF/rewrite`, each containing one or more recipes.
---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.UseOpenRewriteNullable
name: dev.langchain4j.UseOpenRewriteNullable
displayName: Prefer OpenRewrite Nullable
description: Replaces JetBrains Nullable with OpenRewrite Nullable.
recipeList:
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/rewrite/stringutils.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

---
type: specs.openrewrite.org/v1beta/recipe
name: com.yourorg.UseApacheStringUtils
name: dev.langchain4j.UseApacheStringUtils
displayName: Use Apache `StringUtils`
description: Replace Spring string utilities with Apache string utilities.
recipeList:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import com.yourorg.table.ClassHierarchyReport;
import dev.langchain4j.table.ClassHierarchyReport;
import org.junit.jupiter.api.Test;
import org.openrewrite.test.RecipeSpec;
import org.openrewrite.test.RewriteTest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand All @@ -26,7 +26,7 @@
class UseApacheStringUtilsTest implements RewriteTest {
@Override
public void defaults(RecipeSpec spec) {
spec.recipeFromResources("com.yourorg.UseApacheStringUtils")
spec.recipeFromResources("dev.langchain4j.UseApacheStringUtils")
// Notice how we only pass in `spring-core` as the classpath, but not `commons-lang3`.
// That's because we only need dependencies to compile the before code blocks, not the after code blocks.
.parser(JavaParser.fromJavaVersion().classpath("spring-core"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.yourorg;
package dev.langchain4j;

import org.junit.jupiter.api.Test;
import org.openrewrite.DocumentExample;
Expand All @@ -29,7 +29,7 @@ class UseOpenRewriteNullableTest implements RewriteTest {
public void defaults(RecipeSpec spec) {
spec
// Use the fully qualified class name of the recipe defined in src/main/resources/META-INF/rewrite/rewrite.yml
.recipeFromResources("com.yourorg.UseOpenRewriteNullable")
.recipeFromResources("dev.langchain4j.UseOpenRewriteNullable")
// The before and after text blocks contain references to annotations from these two classpath entries
.parser(JavaParser.fromJavaVersion().classpath("annotations", "rewrite-core"));
}
Expand Down

6 comments on commit ed25a8e

@timtebeek
Copy link

Choose a reason for hiding this comment

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

Let me know if there's any use cases you'd like to go over that I can help with!

@langchain4j
Copy link
Collaborator

Choose a reason for hiding this comment

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

@timtebeek thank you for offering help!
We are working on 1.0 version which will include quite a bit of renamings and API changes. Here is the first "batch" of changes.
I was considering creating OpenRewrite recipes for all/possible changes.
I was wondering if there is a way to automatically create recipes from @Deprecated annotations/javadoc or maybe when I do refactoring in IDEA?
Any help with this is much appreciated 🙏

@timtebeek
Copy link

Choose a reason for hiding this comment

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

Great to see! From the documented replacements it seems like most of these could be declarative yaml recipe replacements. Perhaps good to kick off with a draft PR with some tests showing the before/after you're looking for, and then I can help fill out the blanks if I find time over the weekend.

@timtebeek
Copy link

Choose a reason for hiding this comment

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

Sorry for the slower-than-usual response; we're working through a change to first capture any arguments passed into @Deprecated annotations (or any annotations really) to then be able to use that when generating or deducing recipes.

@langchain4j
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @timtebeek, I did not had time to look into this yet, sorry.

I did not do any big renamings yet, but it will come soon. I also hope that most of it could be handled with declarative yaml as you've suggested.

@timtebeek
Copy link

Choose a reason for hiding this comment

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

All good; feel free to tag me on any draft PR if you'd want me to have a look; or reach out through our Slack if you have any questions before then.

Please sign in to comment.