Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(4)

Issue 28107: High global cost is assigned to switch statements on enums

Can't Edit
Can't Publish+Mail
Start Review
Created:
17 years, 2 months ago by Alex
Modified:
11 years, 6 months ago
Reviewers:
Shyam
CC:
testability-explorer-dev_googlegroups.com
Base URL:
http://testability-explorer.googlecode.com/svn/trunk
Visibility:
Public.

Description

When a Java 1.5 enhanced switch statement is used on an enum, a synthetic class is created as an anonymous inner class of the class where the switch statement appears. That synthetic class stores a statuc array of the values of the enum, which is named $SwitchMap$com$google$AnEnum. What's more, the number of assignments into that array is pyramid(N), where N is the number of case clauses in the switch. Ie. for 14 case clauses, we got a global cost of 105. We don't want to record the assignments into this JVM-internal array.

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+65 lines, -6 lines) Patch
core/src/main/java/com/google/test/metric/method/op/turing/ArrayAssignment.java View 2 chunks +14 lines, -4 lines 0 comments Download
core/src/test/java/com/google/test/metric/InnerEnumHolder.java View 1 chunk +40 lines, -0 lines 0 comments Download
core/src/test/java/com/google/test/metric/MetricComputerTest.java View 3 chunks +11 lines, -2 lines 0 comments Download

Messages

Total messages: 2
Alex
17 years, 2 months ago (2009-03-26 00:18:52 UTC) #1
Shyam
17 years, 2 months ago (2009-03-26 00:22:25 UTC) #2
LGTM
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b