Skip to content

Dealing with missing types and symbols #74

Open
@cal101

Description

Question

Should walkmod have some kind of propagatable incomplete or error symbol and type?

The problem

Walkmod does have a "try your best and continue on error" philosophy.
When it comes to missing symbols that currently means "continue with next compilation unit".
That could be improved.

I am aware of 2 cases where missing symbols happen in operational code:

  1. When code is disabled via "if(false)" either no or incomplete (?) class files are generated for anonymous classes.
  2. Walkmod typically resolves more constructors, fields, methods and types of thirdparty libraries than operational code needs at runtime. That results in "NoClassDefFoundError" on analysis.

The simple variants of case 1 were fixed by pull requests that ignore missing anonymous classes in disabled code and use specially marked SymbolType.
When anonymous classes have fields and extra methods or other members i discovered recently that the marked symbols have to be considered to ignore more otherwise fatal cases.
This is related to case 2 above where symbols of thirdparty types can't be resolved if some class is not contained in the runtime jars of the project because it't not needed or it's optional.

I would like to support a form of continue-on-missing-class strategy here to.
The idea is to ignore all or a list of missing classes by configuration and introduce an "error" symboltype. The error symboltype is treated as a special case that can propagate if used for resolving fields or methods.
This introduces a new category of visitors: visitors need to signal awareness of incomplete symbols to avoid accessing class, method or field data.
So far this allowed me some more simple refactorings than before.
But otherwise this causes rippling changes.
Code and configuration has to request the new behavior so nothing should change for existing code.
What do you think? Is that some useful direction?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions