Skip to content

Commit

Permalink
Fix thread safety issues by not using singletons for generators (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnodet authored Feb 17, 2024
1 parent b128a31 commit 9a4a130
Show file tree
Hide file tree
Showing 20 changed files with 0 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -57,7 +56,6 @@
* Generate a basic conversion class between two versions of a model.
*/
@Named("converters")
@Singleton
public class ConverterGenerator extends AbstractJavaModelloGenerator {
public void generate(Model model, Properties parameters) throws ModelloException {
initialize(model, parameters);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -53,7 +52,6 @@
* @author <a href="mailto:brett@codehaus.org">Brett Porter</a>
*/
@Named("dom4j-reader")
@Singleton
public class Dom4jReaderGenerator extends AbstractXmlJavaGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -56,7 +55,6 @@
* @author <a href="mailto:brett@codehaus.org">Brett Porter</a>
*/
@Named("dom4j-writer")
@Singleton
public class Dom4jWriterGenerator extends AbstractXmlJavaGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -55,7 +54,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("jackson-reader")
@Singleton
public class JacksonReaderGenerator extends AbstractJacksonGenerator {

private static final String SOURCE_PARAM = "source";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand All @@ -50,7 +49,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("jackson-writer")
@Singleton
public class JacksonWriterGenerator extends AbstractJacksonGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.io.Serializable;
Expand Down Expand Up @@ -69,7 +68,6 @@
* @author <a href="mailto:jason@modello.org">Jason van Zyl</a>
*/
@Named("java")
@Singleton
public class JavaModelloGenerator extends AbstractJavaModelloGenerator {

private Collection<String> immutableTypes = new HashSet<String>(Arrays.asList(new String[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
package org.codehaus.modello.plugin.jdom;

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.ArrayList;
Expand Down Expand Up @@ -48,7 +47,6 @@
* @author mkleint@codehaus.org
*/
@Named("jdom-writer")
@Singleton
public class JDOMWriterGenerator extends AbstractJDOMGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -52,7 +51,6 @@
* @since 1.8
*/
@Named("jsonschema")
@Singleton
public final class JsonSchemaGenerator extends AbstractXmlJavaGenerator {

public void generate(Model model, Properties parameters) throws ModelloException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -55,7 +54,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("sax-writer")
@Singleton
public class SaxWriterGenerator extends AbstractXmlJavaGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import org.codehaus.modello.model.ModelClass;

Expand All @@ -33,7 +32,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("snakeyaml-extended-reader")
@Singleton
public class SnakeYamlExtendedReaderGenerator extends SnakeYamlReaderGenerator {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -53,7 +52,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("snakeyaml-reader")
@Singleton
public class SnakeYamlReaderGenerator extends AbstractSnakeYamlGenerator {

private static final String SOURCE_PARAM = "source";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand All @@ -50,7 +49,6 @@
* @author <a href="mailto:simonetripodi@apache.org">Simone Tripodi</a>
*/
@Named("snakeyaml-writer")
@Singleton
public class SnakeYamlWriterGenerator extends AbstractSnakeYamlGenerator {

public void generate(Model model, Properties parameters) throws ModelloException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.Arrays;
Expand Down Expand Up @@ -58,7 +57,6 @@
* @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
*/
@Named("stax-reader")
@Singleton
public class StaxReaderGenerator extends AbstractStaxGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.ArrayList;
Expand All @@ -48,7 +47,6 @@
* @author Benjamin Bentmann
*/
@Named("stax-serializer")
@Singleton
public class StaxSerializerGenerator extends AbstractStaxGenerator {

public void generate(Model model, Properties parameters) throws ModelloException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -55,7 +54,6 @@
* @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse </a>
*/
@Named("stax-writer")
@Singleton
public class StaxWriterGenerator extends AbstractStaxGenerator {

private boolean requiresDomSupport;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import org.codehaus.modello.model.ModelClass;

Expand All @@ -33,7 +32,6 @@
* @author Benjamin Bentmann
*/
@Named("xpp3-extended-reader")
@Singleton
public class Xpp3ExtendedReaderGenerator extends Xpp3ReaderGenerator {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import org.codehaus.modello.plugin.java.javasource.JClass;
import org.codehaus.modello.plugin.java.javasource.JField;
Expand All @@ -39,7 +38,6 @@
* @since 1.10
*/
@Named("xpp3-extended-writer")
@Singleton
public class Xpp3ExtendedWriterGenerator extends Xpp3WriterGenerator {
@Override
protected boolean isLocationTracking() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -58,7 +57,6 @@
* @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse</a>
*/
@Named("xpp3-reader")
@Singleton
public class Xpp3ReaderGenerator extends AbstractXpp3Generator {

private static final String SOURCE_PARAM = "source";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -54,7 +53,6 @@
* @author <a href="mailto:evenisse@codehaus.org">Emmanuel Venisse </a>
*/
@Named("xpp3-writer")
@Singleton
public class Xpp3WriterGenerator extends AbstractXpp3Generator {
private String extendedClassnameSuffix;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
*/

import javax.inject.Named;
import javax.inject.Singleton;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -52,7 +51,6 @@
* @author <a href="mailto:brett@codehaus.org">Brett Porter</a>
*/
@Named("xsd")
@Singleton
public class XsdGenerator extends AbstractXmlGenerator {
/**
* Value standing for any element name (used on xml.tagName)
Expand Down

0 comments on commit 9a4a130

Please sign in to comment.