Skip to content

Commit

Permalink
feat: use class like declaration identifiers retriever for interface
Browse files Browse the repository at this point in the history
  • Loading branch information
jpedroh committed May 25, 2024
1 parent c399d3b commit 4fccfbd
Show file tree
Hide file tree
Showing 5 changed files with 82 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/tests/scenarios/functional-interface/base.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
public class CostModelMatcher<T extends Artifact<T>> implements MatcherInterface<T> {
private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName());

/**
* A function weighing a matching that incurred a cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface SimpleWeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching);
}

/**
* A function weighing a matching that incurred a specific cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface WeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching, float quantity);
}
}
26 changes: 26 additions & 0 deletions bin/tests/scenarios/functional-interface/left.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
public class CostModelMatcher<T extends Artifact<T>> implements MatcherInterface<T> {
private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName());

/**
* A function weighing a matching that incurred a cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface SimpleWeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching);
float weight(CMMatching<T> matching);
}

/**
* A function weighing a matching that incurred a specific cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface WeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching, float quantity);
}
}
1 change: 1 addition & 0 deletions bin/tests/scenarios/functional-interface/merge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
public class CostModelMatcher < T extends Artifact < T > > implements MatcherInterface < T > { private static final Logger LOG = Logger . getLogger ( CostModelMatcher . class . getCanonicalName ( ) ) ; @ FunctionalInterface public interface SimpleWeightFunction < T extends Artifact < T > > { float weigh ( CMMatching < T > matching ) ; float weight ( CMMatching < T > matching ) ; } @ FunctionalInterface public interface WeightFunction < T extends Artifact < T > > { float weigh ( CMMatching < T > matching , float quantity ) ; float weight ( CMMatching < T > matching , float quantity ) ; } }
26 changes: 26 additions & 0 deletions bin/tests/scenarios/functional-interface/right.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
public class CostModelMatcher<T extends Artifact<T>> implements MatcherInterface<T> {
private static final Logger LOG = Logger.getLogger(CostModelMatcher.class.getCanonicalName());

/**
* A function weighing a matching that incurred a cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface SimpleWeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching);
}

/**
* A function weighing a matching that incurred a specific cost.
*
* @param <T> the type of the artifacts
*/
@FunctionalInterface
public interface WeightFunction<T extends Artifact<T>> {

float weigh(CMMatching<T> matching, float quantity);
float weight(CMMatching<T> matching, float quantity);
}
}
4 changes: 4 additions & 0 deletions matching_handlers/src/java/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,9 @@ pub fn get_default_java_matching_handlers<'a>() -> MatchingHandlers<'a> {
"enum_declaration",
compute_matching_score_for_class_like_declaration,
);
matching_handlers.register(
"interface_declaration",
compute_matching_score_for_class_like_declaration,
);
matching_handlers
}

0 comments on commit 4fccfbd

Please sign in to comment.