• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

raphw / byte-buddy / #642

20 Aug 2024 09:12AM CUT coverage: 85.383% (-0.006%) from 85.389%
#642

push

raphw
Delegate class reader to factories.

28757 of 33680 relevant lines covered (85.38%)

0.85 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

28.57
/byte-buddy-dep/src/main/java-6/net/bytebuddy/build/CachedReturnPlugin$Advice$boolean.java
1
/*
2
 * Copyright 2014 - Present Rafael Winterhalter
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package net.bytebuddy.build;
17

18
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
19
import net.bytebuddy.asm.Advice;
20

21
/**
22
 * An advice class for caching a {@code boolean} value.
23
 */
24
@SuppressFBWarnings(value = "NM_CLASS_NAMING_CONVENTION", justification = "Name is chosen to optimize for simple lookup")
25
class CachedReturnPlugin$Advice$boolean {
26

27
    /**
28
     * A constructor that prohibits the instantiation of the class.
29
     */
30
    private CachedReturnPlugin$Advice$boolean() {
1✔
31
        throw new UnsupportedOperationException("This class is merely an advice template and should not be instantiated");
1✔
32
    }
33

34
    /**
35
     * The enter advice.
36
     *
37
     * @param cached The cached field's value.
38
     * @return {@code true} if a cached value exists.
39
     */
40
    @Advice.OnMethodEnter(skipOn = Advice.OnNonDefaultValue.class)
41
    protected static boolean enter(@CachedReturnPlugin.CacheField boolean cached) {
42
        return cached;
×
43
    }
44

45
    /**
46
     * The exit advice.
47
     *
48
     * @param returned The value that was returned by the method's execution or {@code 0} if it was not executed.
49
     * @param cached   The previously cached value or {@code 0} if no previous value exists.
50
     */
51
    @Advice.OnMethodExit
52
    @SuppressFBWarnings(value = {"UC_USELESS_VOID_METHOD", "IP_PARAMETER_IS_DEAD_BUT_OVERWRITTEN"}, justification = "Advice method serves as a template")
53
    protected static void exit(@Advice.Return(readOnly = false) boolean returned, @CachedReturnPlugin.CacheField boolean cached) {
54
        if (returned) {
×
55
            cached = true;
×
56
        } else {
57
            returned = true;
×
58
        }
59
    }
×
60
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc