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

FirstInstance post refactoring null checks #10

Draft
wants to merge 36 commits into
base: build-pipeline
Choose a base branch
from

Conversation

AlpTorac
Copy link
Contributor

@AlpTorac AlpTorac commented Sep 3, 2024

Introduction

Complements the preceding pull request (#9) with some null checks that prevent several NullPointerExceptions (NPEs).

Since some files were also formatted in the process, ignoring space and commentary differences makes the important changes more visible.

Details

The NPEs handled here can occur when certain attributes of certain Java-Model elements (in form of EObject instances) are not set properly. To circumvent such NPEs, null checks were added to Java-related "inner switches". Concretely, at positions where certain getter/access methods could return null.

Some added null checks are in form of: if (var1 == null ^ var2 == null) return false;

If differences between var1 and var2 break similarity checking, only one side being null should immediately result in both objects not being similar. Their purpose is to detect differing attributes, which are relevant for similarity checking, and to return early, without proceeding further.

from SimilarityChecker and related classes
Implement requests and handlers for certain similarity checking operations used in Java similarity switches

Helps centralise the said operations

Helps encapsulates some parameters that would otherwise unnecessarily clutter similarity checker and similarity switches
Builds upon the ...similarity.base package, extends and complements its elements with EMFtext

Provides exemplary similarity checking requests and handlers (using them is not mandatory)
For Java-related similarity switches

Currently empty

Can help separate Java-related similarity switches from the rest in the future
to keep the logging logic for Java-related inner switches in one place
For Java-related inner switches to not implement some mutual operations multiple times
Created for Java-related similarity checking
For PCM-related similarity switches
For PCM-related inner similarity switches
For PCM-related similarity checker

Use the extracted structure
For ID-based similarity checking of PCMs

A separate similarity checker implementation will no longer be necessary

To be integrated in the following future commits
For Java-related similarity checking
For logging Java-related inner switches
To their own files without modifying them

Non-functional commit
Rename SimilaritySwitch to JavaSimilaritySwitch to indicate its intent better

Use the extracted inner switches in the JavaSimilaritySwitch

Non-functional commit
To create new Java-related similarity switches

Non-functional commit
For Java-related inner switches that create further switches

Non-functional commit
Use extracted structure in the Java-related inner switches

Use implemented interfaces in the Java-related inner switches

Non-functional commit
For Java-related similarity checking

Non-functional commit
Rename SimilarityChecker to JavaSimilarityChecker

Use the extracted structure in the JavaSimilarityChecker

Delegate similarity switch creation by using a new similarity switch request

Non-functional commit
Adapt classes affected by the changes to the Java-related part of the similarity checking

Non-functional commit
To their own files without modifying them

Non-functional commit
Use the extracted structure in PCM-related similarity switch

Use extracted inner switches in PCM-related similarity switch

Non-similarity switch
For creating new PCM-related similarity switches

Non-functional commit
For PCM-related inner switches that create further switches

Non-functional commit
Use implemented interfaces in PCM-related inner switches

Use extracted structure in PCM-related inner switches

Non-functional commit
For PCM similarity checker construction

Non-functional commit
The dynamic toolbox can be set to use ID-based similarity checking handler

Non-functional commit
To the PCM related similarity checker construction

The FirstInstance should now work in a vacuum

SecondInstance is not adapted to the changes yet
The SecondInstance should now work with the preceding changes to FirstInstance
Remove some intusive, non-informative log messages

Format them too
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