generated from konveyor-ecosystem/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
- Loading branch information
1 parent
79a7389
commit 402fcf6
Showing
7 changed files
with
806 additions
and
399 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
171 changes: 171 additions & 0 deletions
171
notebooks/evaluation/templates/few_shot/easy_hardcoded_summary.jinja
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,171 @@ | ||
{% if model_provider.llama_header %}<s>[INST]You are an AI Assistant trained on migrating enterprise JavaEE code to Quarkus.<<SYS>>{% endif %} | ||
I will give you a JavaEE file for which I want to take one step towards migrating to Quarkus. | ||
|
||
I will provide you with static source code analysis information highlighting an issue which needs to be addressed. | ||
|
||
Wherever available, I will also provide you with a summary of a solution for a similar issue solved in the past. | ||
|
||
You can refer to the solved example for a pattern of how to update the input Java EE file to Quarkus. | ||
|
||
Fix the problem described. | ||
|
||
Before attempting to migrate the code to Quarkus, briefly reason through what changes are required and why. | ||
|
||
Pay attention to changes you make to imports we need to consider. | ||
|
||
Remember when updating or adding annotations that the class must be imported. | ||
|
||
After you have shared your step by step thinking, provide a full output of the updated file. | ||
|
||
# Input information | ||
|
||
## Input File | ||
|
||
File name: "ShoppingCart.java" | ||
Source file contents: | ||
```java | ||
package com.redhat.coolstore.model; | ||
|
||
import java.io.Serializable; | ||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import javax.enterprise.context.Dependent; | ||
|
||
@Dependent | ||
public class ShoppingCart implements Serializable { | ||
|
||
private static final long serialVersionUID = -1108043957592113528L; | ||
|
||
private double cartItemTotal; | ||
|
||
private double cartItemPromoSavings; | ||
|
||
private double shippingTotal; | ||
|
||
private double shippingPromoSavings; | ||
|
||
private double cartTotal; | ||
|
||
private List<ShoppingCartItem> shoppingCartItemList = new ArrayList<ShoppingCartItem>(); | ||
|
||
public ShoppingCart() { | ||
|
||
} | ||
|
||
public List<ShoppingCartItem> getShoppingCartItemList() { | ||
return shoppingCartItemList; | ||
} | ||
|
||
public void setShoppingCartItemList(List<ShoppingCartItem> shoppingCartItemList) { | ||
this.shoppingCartItemList = shoppingCartItemList; | ||
} | ||
|
||
public void resetShoppingCartItemList() { | ||
shoppingCartItemList = new ArrayList<ShoppingCartItem>(); | ||
} | ||
|
||
public void addShoppingCartItem(ShoppingCartItem sci) { | ||
|
||
if ( sci != null ) { | ||
|
||
shoppingCartItemList.add(sci); | ||
|
||
} | ||
|
||
} | ||
|
||
public boolean removeShoppingCartItem(ShoppingCartItem sci) { | ||
|
||
boolean removed = false; | ||
|
||
if ( sci != null ) { | ||
|
||
removed = shoppingCartItemList.remove(sci); | ||
|
||
} | ||
|
||
return removed; | ||
|
||
} | ||
|
||
public double getCartItemTotal() { | ||
return cartItemTotal; | ||
} | ||
|
||
public void setCartItemTotal(double cartItemTotal) { | ||
this.cartItemTotal = cartItemTotal; | ||
} | ||
|
||
public double getShippingTotal() { | ||
return shippingTotal; | ||
} | ||
|
||
public void setShippingTotal(double shippingTotal) { | ||
this.shippingTotal = shippingTotal; | ||
} | ||
|
||
public double getCartTotal() { | ||
return cartTotal; | ||
} | ||
|
||
public void setCartTotal(double cartTotal) { | ||
this.cartTotal = cartTotal; | ||
} | ||
|
||
public double getCartItemPromoSavings() { | ||
return cartItemPromoSavings; | ||
} | ||
|
||
public void setCartItemPromoSavings(double cartItemPromoSavings) { | ||
this.cartItemPromoSavings = cartItemPromoSavings; | ||
} | ||
|
||
public double getShippingPromoSavings() { | ||
return shippingPromoSavings; | ||
} | ||
|
||
public void setShippingPromoSavings(double shippingPromoSavings) { | ||
this.shippingPromoSavings = shippingPromoSavings; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "ShoppingCart [cartItemTotal=" + cartItemTotal | ||
+ ", cartItemPromoSavings=" + cartItemPromoSavings | ||
+ ", shippingTotal=" + shippingTotal | ||
+ ", shippingPromoSavings=" + shippingPromoSavings | ||
+ ", cartTotal=" + cartTotal + ", shoppingCartItemList=" | ||
+ shoppingCartItemList + "]"; | ||
} | ||
} | ||
|
||
``` | ||
|
||
## Issues | ||
|
||
### incident 0 | ||
Line number: 7 | ||
Message: Replace `javax.enterprise` with `jakarta.enterprise` | ||
Solution summary: | ||
The change made to address the migration issue is the replacement of the import statement javax.enterprise.context.Dependent with jakarta.enterprise.context.Dependent. This updates the code to be compatible with Quarkus, which uses the jakarta namespace instead of javax. | ||
|
||
# Output Instructions | ||
Structure your output exactly in Markdown format such as: | ||
|
||
## Reasoning | ||
Write the step by step reasoning in this markdown section. Do not include code in this section, please only include text. | ||
|
||
## Updated File | ||
```java | ||
// Write the full updated file for Quarkus in this section. If the file should be removed, make the content of the updated file a comment explaining it should be removed. | ||
``` | ||
|
||
|
||
Make sure your output is exactly in the format described above. Pay special attention to markdown sections. | ||
|
||
{% if model_provider.model_id == 'mistralai/mixtral-8x7b-instruct-v01' %} | ||
Only use ## to begin section headers in the markdown above. Output the entire file. | ||
{% endif %} | ||
|
||
{% if model_provider.llama_header %}[/INST]{% endif %} |
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
Oops, something went wrong.