Skip to content
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

[core] Consolidate @InternalApi classes #4348

Closed
Tracked by #3898
adangel opened this issue Jan 23, 2023 · 0 comments · Fixed by #4809
Closed
Tracked by #3898

[core] Consolidate @InternalApi classes #4348

adangel opened this issue Jan 23, 2023 · 0 comments · Fixed by #4809
Labels
in:pmd-internals Affects PMD's internals
Milestone

Comments

@adangel
Copy link
Member

adangel commented Jan 23, 2023

  • Review, which classes are marked as internal api
  • Move these classes into internal sub-packages, if possible. Or make this classes package-private.

Annotated with @InternalApi

✔️ everything done now


Done

Everything that's done...

pmd-compat6 - we keep this as is, no additional change in this module

  • net.sourceforge.pmd.util.filter.Filters
  • net.sourceforge.pmd.Report#Report
  • net.sourceforge.pmd.Report#addRuleViolation
  • net.sourceforge.pmd.Report#addConfigError
  • net.sourceforge.pmd.Report#addError

pmd-core

  • now public API

    • net.sourceforge.pmd.lang.document.FileCollector
      • #getCollectedFiles and #getReporter are promoted to public API
  • done - in some other way

    • net.sourceforge.pmd.renderers.AbstractAccumulatingRenderer#renderFileReport
      • the method is made final, so that it can't be overridden anymore in subclasses. That's how the AccumulatingRenderer works now.
  • to be hidden

    • net.sourceforge.pmd.cache.AbstractAnalysisCache
    • net.sourceforge.pmd.cache.AnalysisCache
    • net.sourceforge.pmd.cache.AnalysisCacheListener
    • net.sourceforge.pmd.cache.AnalysisResult
    • net.sourceforge.pmd.cache.CachedRuleMapper
    • net.sourceforge.pmd.cache.CachedRuleViolation
    • net.sourceforge.pmd.cache.ChecksumAware
    • net.sourceforge.pmd.cache.FileAnalysisCache
    • net.sourceforge.pmd.cache.NoopAnalysisCache
    • whole package net.sourceforge.pmd.cache
    • net.sourceforge.pmd.lang.LanguageProcessor.AnalysisTask#AnalysisTask
      • also make net.sourceforge.pmd.lang.LanguageProcessor.AnalysisTask#withFiles internal, that's the other way to create a new AnalysisTask
      • Accessible through a InternalApiBridge
  • net.sourceforge.pmd.util.log.MessageReporter (TODO: Rename to PmdReporter)

  • Already in internal packages

    • net.sourceforge.pmd.util.log.internal.ErrorsAsWarningsReporter
    • net.sourceforge.pmd.util.log.internal.QuietReporter
    • net.sourceforge.pmd.util.log.internal.SimpleMessageReporter
  • net.sourceforge.pmd.util.ResourceLoader

  • net.sourceforge.pmd.cpd.Tokens#Tokens()

    • is hidden
  • net.sourceforge.pmd.cpd.Tokens

    • is not anymore InternalApi, because it is used in public API: net.sourceforge.pmd.cpd.TokenEntry#getImage
  • net.sourceforge.pmd.lang.rule.RuleTargetSelector#isRuleChain

    • removed, as it was only used in a unit test
  • net.sourceforge.pmd.rules.RuleFactory ([core] Consolidate n.s.pmd.lang.rule package #4799 !!)

    • already made package private with the PR
  • net.sourceforge.pmd.RuleSetReference ([core] Consolidate n.s.pmd.lang.rule package #4799 !!)

    • already moved into internal package with the PR
  • net.sourceforge.pmd.RuleSetReferenceId ([core] Consolidate n.s.pmd.lang.rule package #4799 !!)

    • already moved into internal package with the PR
  • net.sourceforge.pmd.RuleSets ([core] Consolidate n.s.pmd.lang.rule package #4799 !!)

    • already moved into internal package with the PR
  • net.sourceforge.pmd.Report - made the following methods private

  • net.sourceforge.pmd.RuleContext

  • To be done after [core] Consolidate n.s.pmd.reporting package #4803 is merged:

    • net.sourceforge.pmd.lang.rule.ParametricRuleViolation ([core] Consolidate n.s.pmd.reporting package #4803 !!)
      • Maybe most of the constructors can be made package private. It's only created in RuleContext... this might need to stay internal API - maybe it can be moved into InternalApiBridge as well...
      • Should be made package private and added to the InternalApiBridge
  • To be done after [core] Consolidate n.s.pmd.lang.rule package #4799 is merged:

    • net.sourceforge.pmd.RuleSet
      • applies(net.sourceforge.pmd.lang.document.FileId)
      • applies(net.sourceforge.pmd.Rule, net.sourceforge.pmd.lang.LanguageVersion)
      • These should be made package private and a InternalApiBridge class should be provided to make them accessible where needed.
    • net.sourceforge.pmd.RuleSetLoader#loadRuleSetsWithoutException
      • Should be made package private and added to the InternalApiBridge
    • net.sourceforge.pmd.RuleSetLoadException#RuleSetLoadException(net.sourceforge.pmd.RuleSetReferenceId, java.lang.Throwable)
      • Should be made package private and added to the InternalApiBridge
    • net.sourceforge.pmd.RuleSetLoadException#RuleSetLoadException(net.sourceforge.pmd.RuleSetReferenceId, java.lang.String)
      • Should be made package private and added to the InternalApiBridge
  • net.sourceforge.pmd.RuleSet#removeDysfunctionalRules ([core] Undeprecate PropertySource::dysfunctionReason in PMD 7 #4793 !!)

  • net.sourceforge.pmd.lang.ast.LexException#LexException(boolean, java.lang.String, int, int, java.lang.String, char) (previously TokenMgrError)

    • called only from generated TokenManagers
    • should be made package private and accessed via a InternalApiBridge
  • net.sourceforge.pmd.PMDConfiguration#getAnalysisCache

    • make package private
  • net.sourceforge.pmd.PMDConfiguration#setAnalysisCache(AnalysisCache)

    • make package private
    • Note: the other setAnalysisCache method, which takes a String, is public API
  • net.sourceforge.pmd.lang.document.FileCollector#newCollector(net.sourceforge.pmd.lang.LanguageVersionDiscoverer, net.sourceforge.pmd.util.log.PmdReporter)

    • make package private and access via InternalApiBridge
  • net.sourceforge.pmd.lang.document.FileCollector#newCollector(net.sourceforge.pmd.util.log.PmdReporter)

    • make package private and access via InternalApiBridge
  • net.sourceforge.pmd.lang.rule.xpath.Attribute#replacementIfDeprecated

    • make package private and access via InternalApiBridge
  • net.sourceforge.pmd.properties.PropertyDescriptor#getTypeId

    • make package private and access via InternalApiBridge
  • net.sourceforge.pmd.properties.PropertyTypeId

    • move into internal package

pmd-ant

  • net.sourceforge.pmd.ant.Formatter
    • Note: the whole class can't be internal API, since this is part of the public ant api of PMD (see PMDTask). But the single methods annotated with InternalApi should be hidden
  • net.sourceforge.pmd.ant.Formatter#getRenderer
  • net.sourceforge.pmd.ant.Formatter#start
  • net.sourceforge.pmd.ant.Formatter#end
  • net.sourceforge.pmd.ant.Formatter#isNoOutputSupplied
  • net.sourceforge.pmd.ant.Formatter#newListener
  • net.sourceforge.pmd.ant.PMDTask#getRelativizeRoots

pmd-apex

  • net.sourceforge.pmd.lang.apex.ast.AbstractApexNode#getNode
    • should be package private
    • remove from ApexNode interface
  • net.sourceforge.pmd.lang.apex.ast.ApexParser
    • should not be internal api, no reason why it should.
  • net.sourceforge.pmd.lang.apex.multifile.ApexMultifileAnalysis#ApexMultifileAnalysis
    • should be package private. We need a InternalApiBridge to access it
  • net.sourceforge.pmd.lang.apex.rule.design.AbstractNcssCountRule
    • should be package private
  • net.sourceforge.pmd.lang.apex.rule.AbstractApexUnitTestRule
    • should be package private
  • net.sourceforge.pmd.lang.apex.rule.internal.Helper (already internal)
    • no need for the annotation due to internal package
  • Note: probably creates conflicts with [apex] Use apex-parser and Summit AST #4806

pmd-java

  • net.sourceforge.pmd.lang.java.ast.InternalApiBridge
    • that's fine, nothing to change
  • net.sourceforge.pmd.lang.java.rule.AbstractIgnoredAnnotationRule
    • move into internal package
  • net.sourceforge.pmd.lang.java.symbols.JElementSymbol (experimental)
    • make it public. It is part of public API net.sourceforge.pmd.lang.java.symbols.SymbolVisitor
  • net.sourceforge.pmd.lang.java.types.ast.LazyTypeResolver
    • move into internal package
  • net.sourceforge.pmd.lang.java.types.JMethodSig#internalApi
    • the method should be removed. We should explicitly downcast to the internal api interface where needed.
  • net.sourceforge.pmd.lang.java.types.TypeOps#isSameTypeInInference
    • make package private
    • and add a InternalApiBridge class

pmd-jsp

  • net.sourceforge.pmd.lang.jsp.ast.JspParser#getTokenBehavior
    • move into a InternalApiBridge
    • note: protected method tokenBehavior does the same...
  • net.sourceforge.pmd.lang.jsp.ast.OpenTagRegister (is already package private)
    • no need for the annotation

pmd-modelica

  • net.sourceforge.pmd.lang.modelica.ast.InternalModelicaNodeApi
    • rename to InternalApiBridge to be consistent
  • net.sourceforge.pmd.lang.modelica.resolver.InternalModelicaResolverApi
    • rename to InternalApiBridge to be consistent
  • net.sourceforge.pmd.lang.modelica.resolver.ModelicaSymbolFacade
  • net.sourceforge.pmd.lang.modelica.resolver.ResolutionContext

pmd-plsql

  • net.sourceforge.pmd.lang.plsql.ast.AbstractSelectStatement (is already package private)
  • net.sourceforge.pmd.lang.plsql.ast.InternalApiBridge
  • net.sourceforge.pmd.lang.plsql.rule.design.AbstractNcssCountRule

pmd-scala

  • net.sourceforge.pmd.lang.scala.ScalaLanguageModule#dialectOf

pmd-visualforce

  • net.sourceforge.pmd.lang.vf.ast.OpenTagRegister
  • net.sourceforge.pmd.lang.vf.ast.VfAstInternals

doc

@adangel adangel added the in:pmd-internals Affects PMD's internals label Jan 23, 2023
@adangel adangel added this to the 7.0.0 milestone Jan 23, 2023
@adangel adangel mentioned this issue Jan 23, 2023
55 tasks
@adangel adangel mentioned this issue Aug 17, 2023
5 tasks
adangel added a commit to adangel/pmd that referenced this issue Jan 26, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 26, 2024
PmdReporter is supposed to be used when configuring PMD
(see AbstractConfiguration#setReporter), so it can't be internal.

Refs pmd#4348
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
Both stay Internal API, update javadoc

Refs pmd#4348
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 27, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 28, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 28, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 28, 2024
Introduce InternalApiBridge to collect all internal
API endpoints.

Refs pmd#4348
adangel added a commit to adangel/pmd that referenced this issue Jan 28, 2024
This was not used and not tested.
To be readded with pmd#2736 and pmd#2896

Refs pmd#4348
adangel added a commit to adangel/pmd that referenced this issue Jan 30, 2024
adangel added a commit to adangel/pmd that referenced this issue Jan 30, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
adangel added a commit to adangel/pmd that referenced this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in:pmd-internals Affects PMD's internals
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant