MCPcopy Create free account
hub / github.com/LFYSec/MScan / validateId

Method validateId

src/main/java/pascal/taie/analysis/Analysis.java:61–76  ·  view source on GitHub ↗

Checks if this analysis class declares a public static field "ID" and its value is identical to the analysis id in the configuration.

()

Source from the content-addressed store, hash-verified

59 * and its value is identical to the analysis id in the configuration.
60 */
61 private void validateId() {
62 Class<?> analysisClass = getClass();
63 try {
64 Field idField = analysisClass.getField("ID");
65 String id = (String) idField.get(null);
66 if (!id.equals(getId())) {
67 throw new ConfigException(String.format(
68 "Config ID (%s) and analysis ID (%s) of %s are not matched",
69 getId(), id, analysisClass));
70 }
71 } catch (NoSuchFieldException | IllegalAccessException e) {
72 throw new AnalysisException(String.format("Failed to get analysis ID of %s," +
73 " please add public static field 'ID' in %s" +
74 analysisClass, analysisClass));
75 }
76 }
77}

Callers 1

AnalysisMethod · 0.95

Calls 6

getIdMethod · 0.95
formatMethod · 0.80
getClassMethod · 0.65
getFieldMethod · 0.65
getMethod · 0.65
equalsMethod · 0.45

Tested by

no test coverage detected