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

fix bug when having reference to parametrizable interface before its concrete usage #86

Merged
merged 2 commits into from
Jun 9, 2023
Merged

fix bug when having reference to parametrizable interface before its concrete usage #86

merged 2 commits into from
Jun 9, 2023

Conversation

badetitou
Copy link
Member

In the following case:

package generics;

import java.net.URL;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashMap;


public class OnlyReferenceToGeneric {

    private class InnerClass {
        

        private class InnerInnerClass {
            private final HashMap<String, String> mappings;

            private void solve(final String st) {
                while (this.mappings.keySet().size() > 0) {
                    final String cle = this.mappings.keySet().iterator().next();
                    solve(cle, st);
                }
            }
        }

    } 

}

The call to iterator() lead to the creation of the FamixJavaInterface Iterator instead of ParametrizableIInterface.
When parsing other file after this piece of code, the interface is thus not well retrieved and it creates issue such as class cast exception leading to not parsed file

This PR aims to resolve this issue

@badetitou
Copy link
Member Author

In the PR, we also added a test to ensure that the feature is preserved in the future

@badetitou badetitou merged commit cd80caf into moosetechnology:v3 Jun 9, 2023
@badetitou badetitou deleted the only-ref-to-parametrizable-also-create-parametrizable branch June 9, 2023 12:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant