Comments (5)
@yegor256 please, pay attention to this issue
from jpeek.
I've created pull request #54 for show a bug with generic methods. Pull request relates only for CAMC metric, but if we are going to fix it I will add test for all metrics. Let's see what was happened in tests for class OverrideGenericMethodFromInterface
. Accoding to our current implemented logic we expect in test that CAMC will be calculated as:
l = 2 (two distinct types: int, java.lang.Integer)
k = 2 (methods: construnctor, inc())
a = 1 (type: int) + 1 (type: java.lang.Integer) = 2
CAMC = a / (l * k) = 2 / (2 * 2) = 2 / 4 = 0.5000
But result was 0.3333. It was happend because we counted synthetic
methods. See point 4 with a bytecode that copiler produces. According to that bytecode we calculate:
l = 3 (three distinct types: int, java.lang.Integer, java.lang.Object)
k = 3 (methods: construnctor, inc(), synthetic inc())
a = 1 (type: int) + 1 (type: java.lang.Integer) + 1 (type: java.lang.Object) = 3
CAMC = a / (l * k) = 3 / (3 * 3) = 3 / 9 = 0.3333
I will fix that if we will decide that is wrong behaviour or you can just close pull request without merging and without any fixes.
from jpeek.
@sergey-karazhenets for CAMC:
- So, am I right that we should count only parameter types of method for l?
Yes, totally agree.
- So, should we consider simple types and theirs analogous boxed types as the same types or consider them as different types (like compiler does)?
I think we should treat Integer
and int
as one type. I think that we should introduce a new class which will do exactly that -- fetch the list of types from a method signature. And it has to explicitly say in its Javadoc how do we understand the differences between types. This should not be a decision for CAMC metric only, but for the entire product. Make sense?
- So, is it correct that we consider constructors as methods?
I think we should not consider constructors as methods. Let's try to find some papers that confirm that. Again, let's create a class that will fetch all methods from a class. Let's use it everywhere in all metrics, to make this decision universal for the entire product.
- Should we consider only public methods or consider all methods (public, private, protected, package-private)? I think we should consider all methods, but what do you think?
I would say we pay attention only to public methods.
I will fix that if we will decide that is wrong behaviour or you can just close pull request without merging and without any fixes.
I agree with the fix introduced.
from jpeek.
@sergey-karazhenets once again, let's not forget that there are many metrics. Let's try to make all changes apply to all metrics. Try to introduce new classes, instead of making changes to specific metrics.
from jpeek.
@sergey-karazhenets can you please split this ticket to a few separate tickets? Now it's difficult to track the progress.
from jpeek.
Related Issues (20)
- Calculus.java:39-50: The `node` method in this interface...
- Ccm.java:88-94: Implement NCC calculation with `XmlGraph`...
- MetricsTest.java:37-40: SCOM has an impediment on issue...
- MetricsTest.java:47-51: Add test for LCC with...
- MetricsTest.java:52-61: Skeleton structure has changed in...
- Lcom4Test.java:74-77: LCOM4: Graph algorithm to determine...
- CCM metric realization issue
- OCC metric realization issue
- LCOM4 realization issue
- LCOM3 metric realisation issue
- How to use JPEEK HOT 1
- Problem with CCM metric addition HOT 4
- Problem with CCM metric addition v2 HOT 4
- Problem with CCM metric addition v3
- redeploy HOT 16
- saxon 11
- refresh HOT 18
- UnsupportedOperationException: Records requires ASM8 HOT 8
- release with live settings file HOT 19
- StringIndexOutOfBoundsException: String index out of range: 37 HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpeek.