# Compiler-generated classes, methods and fields in Java

DevFeed: [Compiler-generated classes, methods and fields in Java](<https://devfeed.tech/articles/compiler-generated-classes-methods-and-fields-in-java-38632.md>)

Original publisher: [Read original article](<https://krossovochkin.com/posts/2020_03_19_compiler_generated_classes_methods_and_fields_in_java/>)

Published: 2020-03-19T00:00:00Z

Content type: tutorial

Language: en

Sources: [Vasya Drobushkov](<https://devfeed.tech/sources/vasya-drobushkov.md>)

Topics: [Compiler](<https://devfeed.tech/topics/compiler.md>), [Java](<https://devfeed.tech/topics/java.md>), [Code](<https://devfeed.tech/topics/code.md>), [class](<https://devfeed.tech/topics/class.md>), [classes](<https://devfeed.tech/topics/classes.md>)

Tags: [bytecode](<https://devfeed.tech/tags/bytecode.md>), [classes](<https://devfeed.tech/tags/classes.md>), [code](<https://devfeed.tech/tags/code.md>), [compiler](<https://devfeed.tech/tags/compiler.md>), [documentation](<https://devfeed.tech/tags/documentation.md>), [fields](<https://devfeed.tech/tags/fields.md>), [java](<https://devfeed.tech/tags/java.md>), [source](<https://devfeed.tech/tags/source.md>)

## AI overview

This tutorial explains how the Java compiler generates classes, methods, and fields that do not appear in source code. It covers synthetic members, bridge and access flags, nested classes, generated bytecode, and inspection with javap.

## Source excerpt

Source Introduction When we write program in Java we create some classes, methods, fields and put all of this into our source code -- .java files. After these files are compiled with javac (Java Compiler) into .class files we got a bunch of Java bytecode. It turns out that not only we create classes, methods and fields in our source code, but also compiler by itself can create them when needed. In this article we'll try to get into the compiler-generated topic, will find out what are synthetic and bridge, access flags, learn some new things from official documentation and maybe more. Let's dive in.