I tried to build new type, but SimpleFeatureType.getCoordinateReferenceSystem() returns null

    
   

         Style style = SLD.createLineStyle(Color.BLUE, 1);
            Layer layer = new FeatureLayer(features, style);
            layer.setTitle("GARDEN");
            layerManager.addLayer(layer);
            return layer;
        }
    
        private DefaultFeatureCollection paintGarden (Coordinate[] coordinates, CoordinateReferenceSystem coordinateReferenceSystem) {
            //create polygon
            GeometryFactory geometryFactory = JTSFactoryFinder.getGeometryFactory( );
            com.vividsolutions.jts.geom.Polygon polygonFromCoordinates = geometryFactory.createPolygon(coordinates);
    
            SimpleFeatureTypeBuilder b = new SimpleFeatureTypeBuilder();
    
    //set the name
            b.setName( "Garden" );
    
    //add some properties
            b.add( "name", String.class );
    
    //add a geometry property
            b.setCRS( coordinateReferenceSystem); // set crs first
            b.add( "location", Polygon.class ); // then add geometry
            b.crs(coordinateReferenceSystem);
    //build the type
            final SimpleFeatureType FLAG = b.buildFeatureType();
            System.out.println(FLAG.getCoordinateReferenceSystem());
            SimpleFeatureBuilder builder = new SimpleFeatureBuilder(FLAG);
    
    //add the values
            builder.add( "Sodas");
            builder.add(polygonFromCoordinates);
    
    //build the feature with provided ID
            SimpleFeature feature = builder.buildFeature( "fid.1" );
    
    
            DefaultFeatureCollection featureCollection = new DefaultFeatureCollection("internal",FLAG);
    
    
            featureCollection.add( feature);