+
Skip to content

Bump Roaster to 2.25.0.Final #652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import java.util.ArrayList;
import java.util.List;

import org.jboss.forge.roaster.model.util.Strings;

/**
*
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
Expand Down Expand Up @@ -64,11 +62,11 @@ public String getCatalog()

public boolean isCatalogSet()
{
return !Strings.isNullOrEmpty(catalog);
return catalog != null && !catalog.trim().isEmpty();
}

public boolean isSchemaSet()
{
return !Strings.isNullOrEmpty(schema);
return schema != null && !schema.trim().isEmpty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import org.jboss.forge.furnace.Furnace;
import org.jboss.forge.furnace.container.simple.lifecycle.SimpleContainer;
import org.jboss.forge.roaster.model.util.FormatterProfileReader;
import org.jboss.forge.roaster.model.util.Strings;

public class JavaFormatSourcesCommand extends AbstractUICommand
{
Expand Down Expand Up @@ -74,13 +73,13 @@ public void initializeUI(UIBuilder builder) throws Exception
Configuration userConfig = furnace.getAddonRegistry().getServices(Configuration.class).get();
ResourceFactory resourceFactory = furnace.getAddonRegistry().getServices(ResourceFactory.class).get();
String profileName = userConfig.getString(JavaResource.FORMATTER_PROFILE_NAME_KEY);
if (!Strings.isNullOrEmpty(profileName))
if (profileName != null && !profileName.trim().isEmpty())
{
profilename.setDefaultValue(profileName);
}

String path = userConfig.getString(JavaResource.FORMATTER_PROFILE_PATH_KEY);
if (!Strings.isNullOrEmpty(path))
if (path != null && !path.trim().isEmpty())
{
XMLResource resource = resourceFactory.create(XMLResource.class, new File(path));
profilepath.setDefaultValue(resource);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.commons.lang.StringUtils;
import org.jboss.forge.addon.javaee.cdi.ui.input.Qualifiers;
import org.jboss.forge.addon.parser.java.resources.JavaResource;
import org.jboss.forge.addon.ui.context.UIBuilder;
Expand All @@ -33,7 +34,6 @@
import org.jboss.forge.roaster.model.source.JavaClassSource;
import org.jboss.forge.roaster.model.source.MethodSource;
import org.jboss.forge.roaster.model.source.ParameterSource;
import org.jboss.forge.roaster.model.util.Strings;
import org.jboss.forge.roaster.model.util.Types;

/**
Expand Down Expand Up @@ -145,7 +145,7 @@ public Result execute(UIExecutionContext context) throws Exception
.setBody("")
.setReturnTypeVoid()
.addParameter(returnType.getValue(),
Strings.uncapitalize(Types.toSimpleName(returnType.getValue())) + "ToDispose");
StringUtils.uncapitalize(Types.toSimpleName(returnType.getValue())) + "ToDispose");
disposedParam.addAnnotation(Disposes.class);
for (String qualifier : qualifiers.getValue())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* <p>
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
Expand All @@ -13,17 +13,17 @@
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

import org.apache.commons.lang.StringUtils;
import org.jboss.forge.roaster.model.Annotation;
import org.jboss.forge.roaster.model.Field;
import org.jboss.forge.roaster.model.JavaClass;
import org.jboss.forge.roaster.model.Member;
import org.jboss.forge.roaster.model.Method;
import org.jboss.forge.roaster.model.util.Strings;

/**
*
*
* Utility class for determining use properties of JPA Entities.
*
*
* @author <a href="salem.elrahal@gmail.com">Salem Elrahal</a>
*/
public class JPAEntityUtil
Expand Down Expand Up @@ -58,7 +58,8 @@ else if (member instanceof Field)
{
// It's a getter
if (method.getParameters().size() == 0
&& (method.getReturnType() != null && type.equals(method.getReturnType().getQualifiedName())))
&& (method.getReturnType() != null && type.equals(
method.getReturnType().getQualifiedName())))
{
if (method.getName().toLowerCase().contains(name.toLowerCase()))
{
Expand All @@ -80,7 +81,7 @@ else if (type != null && member.isPublic())
if (member instanceof Method && memberName.startsWith("get"))
{
memberName = memberName.substring(3);
memberName = Strings.uncapitalize(memberName);
memberName = StringUtils.uncapitalize(memberName);
}
result = memberName;
}
Expand All @@ -103,13 +104,15 @@ public static String getEntityTable(final JavaClass<?> entity)
if (entity.hasAnnotation(Entity.class))
{
Annotation<?> a = entity.getAnnotation(Entity.class);
if (!Strings.isNullOrEmpty(a.getStringValue("name")))
String nameAttribute = a.getStringValue("name");
String value = a.getStringValue();
if (nameAttribute != null && !nameAttribute.isEmpty())
{
table = a.getStringValue("name");
table = nameAttribute;
}
else if (!Strings.isNullOrEmpty(a.getStringValue()))
else if (value != null && !value.isEmpty())
{
table = a.getStringValue();
table = value;
}
}
return table;
Expand Down Expand Up @@ -137,7 +140,7 @@ public static String getSelectExpression(JavaClass<?> entity, String entityTable
{
if (name.startsWith("get"))
{
associationField = Strings.uncapitalize(name.substring(3));
associationField = StringUtils.uncapitalize(name.substring(3));
}
}
else if (member instanceof Field)
Expand Down Expand Up @@ -174,7 +177,7 @@ public static String getIdClause(JavaClass<?> entity, String entityTable)
if (member instanceof Method)
{
// Getters are expected to obey JavaBean conventions
id = Strings.uncapitalize(memberName.substring(3));
id = StringUtils.uncapitalize(memberName.substring(3));
}
if (member instanceof Field)
{
Expand All @@ -201,7 +204,7 @@ public static String getOrderClause(JavaClass<?> entity, char entityVariable)
if (member instanceof Method)
{
// Getters are expected to obey JavaBean conventions
id = Strings.uncapitalize(memberName.substring(3));
id = StringUtils.uncapitalize(memberName.substring(3));
}
if (member instanceof Field)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import org.jboss.forge.addon.javaee.jpa.PersistenceContainer;
import org.jboss.forge.addon.parser.java.facets.JavaSourceFacet;
import org.jboss.forge.addon.projects.stacks.Stack;
import org.jboss.forge.roaster.model.util.Strings;
import org.jboss.shrinkwrap.descriptor.api.persistence.PersistenceUnitCommon;

/**
Expand Down Expand Up @@ -39,7 +38,8 @@ public PersistenceUnitCommon setupConnection(PersistenceUnitCommon unit,
@Override
public void validate(JPADataSource dataSource) throws Exception
{
if (Strings.isNullOrEmpty(dataSource.getJndiDataSource()))
String jndiDataSource = dataSource.getJndiDataSource();
if (jndiDataSource == null || jndiDataSource.trim().isEmpty())
{
throw new RuntimeException("Must specify a JNDI data-source.");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import javax.persistence.TypedQuery;
import javax.xml.bind.annotation.XmlRootElement;

import org.apache.commons.lang.StringUtils;
import org.jboss.forge.addon.resource.ResourceFactory;
import org.jboss.forge.addon.templates.Template;
import org.jboss.forge.addon.templates.TemplateFactory;
Expand All @@ -28,7 +29,6 @@
import org.jboss.forge.roaster.model.source.JavaClassSource;
import org.jboss.forge.roaster.model.source.MethodSource;
import org.jboss.forge.roaster.model.util.Refactory;
import org.jboss.forge.roaster.model.util.Strings;
import org.jboss.forge.roaster.model.util.Types;

/**
Expand Down Expand Up @@ -343,11 +343,11 @@ private void addCollectionAssembler(Property<?> property, Type<?> parameterizedT
map.put("fieldName", fieldName);
map.put("fieldGetter", property.getAccessor().getName() + "()");
map.put("nestedDTOType", nestedDTOClass.getName());
map.put("jpaIterator", "iter" + Strings.capitalize(fieldName));
map.put("jpaIterator", "iter" + StringUtils.capitalize(fieldName));
map.put("simpleParameterizedType", simpleParameterizedType);
map.put("jpaVar", Strings.uncapitalize(simpleParameterizedType));
map.put("dtoIterator", "iterDto" + Strings.capitalize(fieldName));
map.put("dtoVar", "dto" + Strings.capitalize(simpleParameterizedType));
map.put("jpaVar", StringUtils.uncapitalize(simpleParameterizedType));
map.put("dtoIterator", "iterDto" + StringUtils.capitalize(fieldName));
map.put("dtoVar", "dto" + StringUtils.capitalize(simpleParameterizedType));
map.put("jpqlVar", simpleParameterizedType.toLowerCase().substring(0, 1));

String output;
Expand Down Expand Up @@ -397,7 +397,7 @@ private void addInitializerFromCollection(Property<?> property, JavaClassSource
Map<Object, Object> map = new HashMap<>();
map.put("fieldName", property.getName());
map.put("nestedDTOType", nestedDTOClass.getName());
map.put("collectionIterator", "iter" + Strings.capitalize(property.getName()));
map.put("collectionIterator", "iter" + StringUtils.capitalize(property.getName()));
map.put("elementType", parameterizedType.getName());
map.put("fieldGetter", property.getAccessor().getName() + "()");
String output;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.jboss.forge.roaster.model.source.AnnotationTargetSource;
import org.jboss.forge.roaster.model.source.JavaClassSource;
import org.jboss.forge.roaster.model.source.PropertySource;
import org.jboss.forge.roaster.model.util.Strings;

@SuppressWarnings("unchecked")
public class ValidationGenerateConstraintWizardStep extends AbstractJavaEECommand implements UIWizardStep
Expand Down Expand Up @@ -312,7 +311,7 @@ private void setArrayValue(AnnotationSource<JavaClassSource> annotation, String
if (!literals.isEmpty())
{
annotation.setLiteralValue(name,
literals.size() == 1 ? literals.get(0) : String.format("{%s}", Strings.join(literals, ",")));
literals.size() == 1 ? literals.get(0) : String.format("{%s}", String.join(",", literals)));
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import org.jboss.forge.roaster.model.Parameter;
import org.jboss.forge.roaster.model.Type;
import org.jboss.forge.roaster.model.source.MethodHolderSource;
import org.jboss.forge.roaster.model.util.Strings;

/**
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a>
Expand Down Expand Up @@ -64,7 +63,7 @@ public String getName()
Type<?> methodReturnType = method.getReturnType();
String returnType = (method.isReturnTypeVoid() || methodReturnType == null) ? "void" : methodReturnType
.getQualifiedName();
return String.format("%s(%s)::%s", method.getName(), Strings.join(parameterTypes, ","), returnType);
return String.format("%s(%s)::%s", method.getName(), String.join(",", parameterTypes), returnType);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jboss.forge.addon.resource.ResourceFacet;
import org.jboss.forge.addon.resource.ResourceFactory;
import org.jboss.forge.addon.resource.util.ResourceUtil;
import org.jboss.forge.furnace.util.Streams;
import org.jboss.forge.roaster.ParserException;
import org.jboss.forge.roaster.Roaster;
import org.jboss.forge.roaster.model.EnumConstant;
Expand All @@ -38,7 +39,6 @@
import org.jboss.forge.roaster.model.Method;
import org.jboss.forge.roaster.model.source.JavaSource;
import org.jboss.forge.roaster.model.util.FormatterProfileReader;
import org.jboss.forge.roaster.spi.Streams;

/**
* @author Mike Brock
Expand Down
2 changes: 1 addition & 1 deletion parser-java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</modules>

<properties>
<version.roaster>2.20.8.Final</version.roaster>
<version.roaster>2.25.0.Final</version.roaster>
</properties>

<dependencyManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import static org.junit.Assert.fail;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.annotation.Documented;
import java.util.List;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -347,7 +348,7 @@ public void testAddUnparsableAnnotation() throws Exception
}
catch (IllegalArgumentException ex)
{
assertTrue(ex.getMessage().contains("Can't parse annotation"));
assertTrue(ex.getMessage().contains("couldn't be added"));
}
}

Expand Down Expand Up @@ -384,7 +385,7 @@ private void createCommandController() throws Exception
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass));
}

private void reloadTargetClass() throws FileNotFoundException
private void reloadTargetClass() throws IOException
{
targetClass = Roaster.parse(JavaClassSource.class,
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.junit.Assert.assertTrue;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.inject.Inject;

Expand Down Expand Up @@ -194,7 +195,7 @@ private void createCommandController() throws Exception
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass));
}

private void reloadTargetClass() throws FileNotFoundException
private void reloadTargetClass() throws IOException
{
targetClass = Roaster.parse(JavaClassSource.class,
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.junit.Assert.assertTrue;

import java.io.FileNotFoundException;
import java.io.IOException;

import javax.inject.Inject;

Expand Down Expand Up @@ -279,7 +280,7 @@ private void createCommandController() throws Exception
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass));
}

private void reloadTargetClass() throws FileNotFoundException
private void reloadTargetClass() throws IOException
{
targetClass = Roaster.parse(JavaClassSource.class,
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
/**
* Copyright 2016 Red Hat, Inc. and/or its affiliates.
*
* <p>
* Licensed under the Eclipse Public License version 1.0, available at
* http://www.eclipse.org/legal/epl-v10.html
*/
package org.jboss.forge.addon.parser.java.ui.methods;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Arrays;

import javax.inject.Inject;
Expand Down Expand Up @@ -73,7 +74,7 @@ public static AddonArchive getDeployment()
@Before
public void setup() throws Exception
{
project = projectFactory.createTempProject(Arrays.<Class<? extends ProjectFacet>> asList(JavaSourceFacet.class));
project = projectFactory.createTempProject(Arrays.<Class<? extends ProjectFacet>>asList(JavaSourceFacet.class));
}

@After
Expand Down Expand Up @@ -442,7 +443,7 @@ private void createCommandController() throws Exception
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass));
}

private void reloadTargetClass() throws FileNotFoundException
private void reloadTargetClass() throws IOException
{
targetClass = Roaster.parse(JavaClassSource.class,
project.getFacet(JavaSourceFacet.class).getJavaResource(targetClass)
Expand Down
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载