-
Notifications
You must be signed in to change notification settings - Fork 762
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the hasAnnotation check more precise (#4547)
- Loading branch information
Showing
57 changed files
with
167 additions
and
121 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2018, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis; | ||
|
@@ -64,6 +64,10 @@ public abstract class AnalyzerFactory { | |
* The genre for files recognized by this kind of analyzer. | ||
*/ | ||
protected AbstractAnalyzer.Genre genre; | ||
/** | ||
* Whether the files can be annotated. | ||
*/ | ||
protected boolean hasAnnotations; | ||
|
||
protected AnalyzerFactory(FileAnalyzerFactory.Matcher matcher, String contentType) { | ||
cachedAnalyzer = new ThreadLocal<>(); | ||
|
@@ -146,12 +150,16 @@ public final AbstractAnalyzer.Genre getGenre() { | |
} | ||
|
||
/** | ||
* The user friendly name of this analyzer. | ||
* The user-friendly name of this analyzer. | ||
* | ||
* @return a genre | ||
*/ | ||
public abstract String getName(); | ||
|
||
public boolean hasAnnotations() { | ||
return hasAnnotations; | ||
} | ||
|
||
public abstract AbstractAnalyzer getAnalyzer(); | ||
|
||
public abstract void returnAnalyzer(); | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2021, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis; | ||
|
@@ -34,14 +34,14 @@ | |
*/ | ||
public class FileAnalyzerFactory extends AnalyzerFactory { | ||
|
||
/** The user friendly name of this analyzer. */ | ||
/** The user-friendly name of this analyzer. */ | ||
private final String name; | ||
|
||
/** | ||
* Create an instance of {@code FileAnalyzerFactory}. | ||
*/ | ||
FileAnalyzerFactory() { | ||
this(null, null, null, null, null, null, null, null); | ||
this(null, null, null, null, null, null, null, null, false); | ||
} | ||
|
||
/** | ||
|
@@ -56,19 +56,21 @@ public class FileAnalyzerFactory extends AnalyzerFactory { | |
* @param contentType content type for this analyzer (possibly {@code null}) | ||
* @param genre the genre for this analyzer (if {@code null}, {@code | ||
* Genre.DATA} is used) | ||
* @param name user friendly name of this analyzer (or null if it shouldn't be listed) | ||
* @param name user-friendly name of this analyzer (or null if it shouldn't be listed) | ||
* @param hasAnnotations whether the files processed by the analyzers produced by this factory can be annotated | ||
*/ | ||
protected FileAnalyzerFactory( | ||
String[] names, String[] prefixes, String[] suffixes, | ||
String[] magics, Matcher matcher, String contentType, | ||
AbstractAnalyzer.Genre genre, String name) { | ||
AbstractAnalyzer.Genre genre, String name, boolean hasAnnotations) { | ||
super(matcher, contentType); | ||
this.names = asList(names); | ||
this.prefixes = asList(prefixes); | ||
this.suffixes = asList(suffixes); | ||
this.magics = asList(magics); | ||
this.genre = (genre == null) ? AbstractAnalyzer.Genre.DATA : genre; | ||
this.name = name; | ||
this.hasAnnotations = hasAnnotations; | ||
} | ||
|
||
/** | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.ada; | ||
|
@@ -41,7 +41,7 @@ public class AdaAnalyzerFactory extends FileAnalyzerFactory { | |
}; | ||
|
||
public AdaAnalyzerFactory() { | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, 2018, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.archive; | ||
|
@@ -57,7 +57,7 @@ protected boolean doesCheckExtraFieldID() { | |
new ZipAnalyzerFactory(); | ||
|
||
private ZipAnalyzerFactory() { | ||
super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, NAME); | ||
super(null, null, SUFFIXES, null, MATCHER, null, AbstractAnalyzer.Genre.XREFABLE, NAME, false); | ||
} | ||
|
||
@Override | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2019, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.c; | ||
|
@@ -44,7 +44,7 @@ public class CAnalyzerFactory extends FileAnalyzerFactory { | |
}; | ||
|
||
public CAnalyzerFactory() { | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.csharp; | ||
|
@@ -35,7 +35,7 @@ public class CSharpAnalyzerFactory extends FileAnalyzerFactory { | |
}; | ||
|
||
public CSharpAnalyzerFactory() { | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, SUFFIXES, null, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2017, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.document; | ||
|
@@ -53,7 +53,7 @@ public AnalyzerFactory forFactory() { | |
new MandocAnalyzerFactory(); | ||
|
||
protected MandocAnalyzerFactory() { | ||
super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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 |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.document; | ||
|
@@ -50,7 +50,7 @@ public AnalyzerFactory forFactory() { | |
new TroffAnalyzerFactory(); | ||
|
||
protected TroffAnalyzerFactory() { | ||
super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, null, null, MATCHER, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ | |
*/ | ||
|
||
/* | ||
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. | ||
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. | ||
* Portions Copyright (c) 2017, Chris Fraire <[email protected]>. | ||
*/ | ||
package org.opengrok.indexer.analysis.erlang; | ||
|
@@ -39,7 +39,7 @@ public class ErlangAnalyzerFactory extends FileAnalyzerFactory { | |
}; | ||
|
||
public ErlangAnalyzerFactory() { | ||
super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME); | ||
super(null, null, SUFFIXES, MAGICS, null, "text/plain", AbstractAnalyzer.Genre.PLAIN, NAME, true); | ||
} | ||
|
||
@Override | ||
|
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.